ros-template(1)
okay bestie, welcome to ros-template(1) β the manual page for the template editor that pairs with ros-init. it's giving template-management main character energy, and ngl this page is lowkey a slay. π
β¨ we're gonna go through every flag and subcommand together, fr fr.
π NAME π
ros-template β Edit template for ros-init. π
πΈ SYNOPSIS πΈ
ros template command args...
β¨ Subcommands β¨
init template-nameβ Create new template inlocal-projectdirectory. π fresh start energydeinit template-nameβ Remove a template fromlocal-projectdirectory. bye-bye template πlistβ Show file list and states of the filestype,chmod,rewritein templates. receipts π§Ύcheckout [template-name]β When invoked withouttemplate-name, this command shows candidates for current templates to operate. If withtemplate-name, this command chooses the name as current template. current-template glow-up πadd [template-name] [files ...]β Add files to current template. The first parameter could be taken as atemplate-namewhen the current template is default. file-wrangling π«Άcat [template-name] [files ...]β Show contents in the current template. peek inside πedit [template-name] [files ...]β Edit content of files in template using/usr/bin/editor. editor time βοΈpath [template-name] [files ...]β Show native path of files in template. where it lives πΊοΈrm [template-name] [files ...]β Remove file from current template. delete πtype [template-name] [type] [files ...]β Change file type. Current choices for types aredjulaorcopy.{{name}}{{author}}{{email}}{{universal_time}}are available variables in the template file. Without files, change default type. strategy switch-up π¦chmod [template-name] [mode] [files ...]β Change file mode bits to generate. Specify mode in octal format. mode bits πrewrite [template-name] file rewrite-ruleβ Change file name using djula template. Variables{{name}}{{author}}{{email}}{{universal_time}}are available forrewrite-rule. rename magic πͺexport [template-name] [directory]β Export files in current template to current directory. export π¦import [directory]β Import template in current directory. import π₯helpβ Show the subcommand help. help π«Ά
π¦ Description π¦
The ros-template(1) command manages templates of projects. no cap. π
π Create template π
First, the init sub-command creates an empty template. β¨
$ ros template init sample-template
Many of the sub-commands take a template name as first argument. But you can omit it by the checkout sub-commands. After the following, such sub-commands are applied to sample-template. π
$ ros template checkout sample-template
Next, the add sub-command adds local file[s] to template. Then, the list sub-command shows information of files in template. π
$ echo "Hello {{ author }}!!" > sample.txt
$ ros template add sample.txt
$ ros template list
copy sample.txt
The word copy means a strategy when applying the template. There are the following 2 strategies. π
copyβ simply copies the file as-is.djulaβ processes the content of the file by template engine, Djula (http://mmontone.github.io/djula/).- Available variables are explained later.
The type sub-command changes it. In addition, default strategy (copy) can be changed for each template by the type sub-command without file names (Ex. ros template type djula). π¦
$ ros template type djula sample.txt
$ ros template list
djula sample.txt
The sample.txt will be simply output as sample.txt in default. But you can change it by the rewrite sub-command. In the following example, it will be output as sample_<project name>.txt. π«
$ ros template rewrite sample.txt "sample-{{ name }}.txt"
$ ros template list
djula sample.txt -> "sample-{{ name }}.txt"
Note: Rewrite rules are always processed by Djula irrespective of strategy of the file. β οΈ
π Apply template π
ros-init(1) can specify a template. πΈ
$ mkdir temp ; cd temp
$ ros init sample-template some-project
$ ls
sample-some-project.txt
$ cat sample-some-project.txt # Assume that "author" is "alien"
Hello alien!!
The file name and its content are processed by Djula as explained in the above. The following variables can be used in default. π
{{name}}: A project name specified inros-init(1){{author}}: An author name extracted from config of Git orwhoami{{email}}: An e-mail address extracted from config of Git or created usingwhoamiandhostname{{universal_time}}: A universal time created byget-universal-timefunction
In addition, you can use original variables as the followings. π
$ echo "Hello {{ area }}!!" > sample.txt
$ ros template add sample.txt # Note: It overwrites existing
$ mkdir temp ; cd temp
$ ros init sample-template roswell --area 51
$ cat sample-roswell.txt
Hello 51!!
π Export and import template π
Basically, ros-template(1) is designed to internally manage added files. π§
However, if you want to, for example, manage it using Git in a local directory or to install distributed templates, you can use the export and import sub-commands. π
First, the export sub-command exports added files and a setting file roswell.init.<template name>.asd that is internally created and edited. β¨
$ ros template export dir
$ ls dir
roswell.init.sample-template.asd sample.txt
$ cat dir/sample.txt
Hello {{ area }}!!
Second, the import sub-command imports them. π«Ά
# Assume that this is another machine...
$ ros template list sample-template # nothing is output
$ ls downloaded
roswell.init.sample-template.asd sample.txt
$ ros template import downloaded
$ ros template list sample-template
djula sample.txt -> "sample-{{ name }}.txt"
Note: If there is a template whose name is same, it will be overwritten. π
π SEE ALSO π
π AUTHORS π
Roswell Project Team.
okay that's the whole page, bestie β the footer has no source/version/date line to report, just the ros-template(1) manual name again. go make something iconic! πβ¨
π¦ where this page comes from
- alpine 3.24: roswell-doc 24.10.115-r1 Β· MIT
- arch rolling: roswell 26.10.119-1 Β· MIT
- nixos 26.05: roswell 26.02.116
- nixpkgs unstable: roswell 26.10.117
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms