Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

yuno-skeleton

Instantiate a new yuno (or gclass) from a named template in the skeleton library.

Usage

yuno-skeleton --list                 # list available skeletons
yuno-skeleton <SKELETON>             # instantiate one
OptionPurpose
<SKELETON>Template to instantiate (positional)
--list / -lList available skeletons
--skeletons-path / -pSkeleton directory (default /yuneta/bin/skeletons)

Run with no skeleton to print the available list. The templates are the ones under utils/c/yuno-skeleton/skeletons/. The build installs them in /yuneta/bin/skeletons and replaces the installed copy whole, except skeletons.d/, where your own templates go.

Example

The name is not an argument: the tool asks for it, then for the template’s variables. The answers are read from stdin, one per line, so a script can pipe them in.

$ yuno-skeleton js_gclass
Enter gclass name: my_widget
One-line description of the gclass ['']: Shows the readings
Author name ['']: ArtGins
Copying '/yuneta/bin/skeletons/js_gclass' in '.'
Creating filename: ./c_my_widget.js

$ printf 'my_widget\nShows the readings\nArtGins\n' | yuno-skeleton js_gclass

c_my_widget.js defines the gclass C_MY_WIDGET, imports from @yuneta/gobj-js and exports register_c_my_widget(). A Yuno template asks for the yuno role (at most 15 characters) and the root gobj name instead.

A new application repository, with one citizen yuno in it:

printf 'my_app\n\nMy application\nArtGins\nsupport@artgins.com\n\n' | yuno-skeleton project
cd my_app/yunos
printf 'my_yuno\n\n1.0.0\nMy yuno\nArtGins\nsupport@artgins.com\nMIT\n' | yuno-skeleton yuno_citizen
sed -i 's|^# add_subdirectory(my_yuno)$|add_subdirectory(my_yuno)|' CMakeLists.txt

project writes an MIT LICENSE. project_commercial writes a proprietary one, and a README section on what a delivery of a closed application must carry. Both make gui/, the web frontend (Vite, @yuneta/gobj-js, the declarative shell of @yuneta/gobj-ui):

cd my_app/gui
npm install
npm run dev

The answers are one line per prompt (an empty line takes the default). An input that ends before a REQUIRED answer (the name) is an error. An input that ends earlier than a prompt with a default takes the default, as an empty line does:

printf 'my_widget\n' | yuno-skeleton gclass_child    # description and author: their defaults
printf '' | yuno-skeleton gclass_child               # ERROR: end of input before every required value was given

A file keeps the mode of its template (an executable *.sh_tmpl makes an executable script), and a symlink with a relative target follows the name its target gets (run.link -> run_+yunorole+.sh_tmpl becomes run.link -> run_myyuno.sh).

TemplateTypeMakes
gclass_service, gclass_childGClassc_<name>.{c,h}
js_gclass, js_gclass_serviceGClassc_<name>.js
c_h_fileGClass<name>.{c,h}, no gobj
yuno_citizen, yuno_standaloneYuno<role>/
c_projectUtility<name>/, a pure C program
project, project_commercialProject<name>/, an application repository with its gui/

See also