[ci skip] added/updated man pages for ros init/template

This commit is contained in:
Masataro Asai 2016-04-12 20:00:21 +09:00
parent aa58435598
commit 780f2f8c6f
7 changed files with 303 additions and 28 deletions

View file

@ -5,7 +5,7 @@
# http://pandoc.org/README.html#using-variables-in-templates
# https://github.com/jgm/pandoc-templates/blob/master/default.man
MDS = ros.md ros-dump.md ros-init.md ros-install.md ros-list.md ros-setup.md ros-config.md ros-delete.md ros-emacs.md ros-run.md ros-use.md ros-wait.md ros-asdf.md
MDS = ros.md ros-dump.md ros-init.md ros-install.md ros-list.md ros-setup.md ros-config.md ros-delete.md ros-emacs.md ros-run.md ros-use.md ros-wait.md ros-asdf.md ros-template.md
# separated by semicolons
PANDOC_AUTHORS="Roswell Project Team"
@ -25,7 +25,7 @@ CLEANFILES = $(HTMLS)
endif
if HTML_GENERATE
HTMLS = $(MDS:%.md=html/%.html) html/ros.css
HTMLS = $(MDS:%.md=html/%.html)
html/%.html: %.md
which pandoc
# awk hack --- check every underlined words for its corresponding md file, replacing it to an appropriate markdown link to html file if it exist (e.g. _ros-use_ -> check ros-use.md -> [ros-use](ros-use.html) )

View file

@ -20,16 +20,20 @@
</header>
<p>ros-init - Create a roswell script (optionally based on a template)</p>
<h1 id="synopsis">Synopsis</h1>
<p><strong>ros init [template]</strong> name</p>
<!-- # subcommands -->
<p><strong>ros init NAME [TEMPLATE [ARGS...]]</strong></p>
<dl>
<dt>template</dt>
<dd>Specify the name of a template.
<dt>TEMPLATE</dt>
<dd><p>Specifies the name of a template, defaulted to <em>default</em> template. However, if <em>TEMPLATE</em> is not specified and <em>FILENAME</em> matches one of the templates being stored, then it automatically uses the template. To suppress this behavior, you should explicitly specify <em>TEMPLATE</em> as <em>default</em>.</p>
<p>Thus you are warned when you use this command from a shell script. In order to achieve a consistent and desired behavior, it is adviced that they should always explicitly specify the template name.</p>
</dd>
<dt>NAME</dt>
<dd><p>Specify the output filename, or &quot;-&quot; to indicate <em>stdout</em>. When <em>TEMPLATE</em> is <em>default</em>, it automatically appends a file type &quot;.ros&quot;.</p>
</dd>
</dl>
<!-- # subcommands -->
<h1 id="description">Description</h1>
<p>Initialises [name].ros.</p>
<p>Initialises a roswell file based on a template. User-specified templates can be added by <em><a href="ros-template.html">ros-template</a></em>(1).</p>
<p>The default template is something like:</p>
<pre><code>#!/bin/sh
#|-*- mode:lisp -*-|#
@ -48,7 +52,7 @@ exec ros -Q -- $0 &quot;$@&quot;
<!-- # Environmental Variables -->
<h1 id="see-also">SEE ALSO</h1>
<p><em>sbcl</em>(1) <em><a href="ros.html">ros</a></em>(1)</p>
<p><em>sbcl</em>(1) <em><a href="ros.html">ros</a></em>(1) <em><a href="ros-template.html">ros-template</a></em>(1)</p>
<p>_</p>
</body>
</html>

View file

@ -0,0 +1,73 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="generator" content="pandoc">
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">
<title>ros-template(1)</title>
<style type="text/css">code{white-space: pre;}</style>
<link rel="stylesheet" href="../ros.css">
<!--[if lt IE 9]>
<script src="//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.3/html5shiv-printshiv.min.js"></script>
<![endif]-->
</head>
<body>
<header>
<h1 class="title">ros-template(1)</h1>
<ul>
<li class="author">Roswell Project Team</li>
</ul>
</header>
<h1 id="synopsis">Synopsis</h1>
<p><strong>ros template</strong> [add|rm|list|show] [OPTIONS] [TEMPLATE [ARGS...]]</p>
<p>Register, manage and remove the templates.</p>
<p>The format of ARGS is same as the lambda list except the following translation:</p>
<ul>
<li>&amp;key, &amp;optional, &amp;rest corresponds to --key, --optional, --rest, respectively.</li>
<li>Abbreviation as -k, -o, -r are available.</li>
<li>Each argument is separated by --, instead of being surrounded by parentheses.</li>
<li>Optional and keyword arguments can have a default value. When no defauilt value is specified, it implies an empty string.</li>
</ul>
<h1 id="examples">Examples</h1>
<p>The following example shows how to register a template file (an asdf system definition) named <em>tmpl.asd</em>, then instantiate the template with some arguments.</p>
<pre><code>$ cat tmpl.asd
(asdf:defsystem NAME :author &quot;AUTHOR&quot; :depends-on DEP :short-description &quot;library by AUTHOR.&quot;)
$ ros template add tmpl.asd NAME AUTHOR --optional DEP &quot;(:alexandria)&quot;
$ ros init result.asd tmpl.asd bob-utilities Bob
Successfully generated: result.asd
$ cat result.asd:
(asdf:defsystem bob-utilities :author &quot;Bob&quot; :depends-on (:alexandria) :short-description &quot;library by Bob.&quot;)</code></pre>
<p>Notice the arguments are READ. Thus you may use &quot;#.&quot; readmacro in order to evaluate the arguments when the template is instantiated. For example,</p>
<pre><code>$ echo $USER
Bob
$ ros init result.asd tmpl.asd bob-utilities &#39;#.(uiop:getenv &quot;USER&quot;)&#39;
$ cat result.asd:
(asdf:defsystem bob-utilities :author &quot;Bob&quot; :depends-on (:alexandria) :short-description &quot;library by Bob.&quot;)</code></pre>
<p>The results are PRINCed, so the results are not escaped with &quot;&quot;. If you want the results to be escaped, it should be done in the template (as in &quot;AUTHOR&quot;).</p>
<h1 id="subcommands">Subcommands</h1>
<dl>
<dt>add</dt>
<dd><p>Registers a file <em>TEMPLATE</em>.</p>
</dd>
<dt>list</dt>
<dd><p>Shows the list of the registered templates.</p>
</dd>
<dt>show</dt>
<dd><p>Describes the contents of <em>TEMPLATE</em> which is already registered.</p>
</dd>
<dt>rm</dt>
<dd><p>Ensures that a template <em>TEMPLATE</em> is removed.</p>
</dd>
</dl>
<h1 id="options-for-ros-template-add">Options for <em>ros template add</em></h1>
<ul>
<li>-f,--force : Overwrites the existing template with the same name without asking</li>
<li>-r,--recursive : register the directory recursively. TEMPLATE should be a directory in order to make this option meaningful.</li>
<li>--name NAME : register the template with a given name, not the original filename.</li>
</ul>
<h1 id="misc">Misc</h1>
<p>Registered templates are stored in directory $ROSWELL_HOME/templates/ .</p>
<h1 id="see-also">SEE ALSO</h1>
<p><em><a href="ros.html">ros</a></em>(1) <em><a href="ros-init.html">ros-init</a></em>(1) _</p>
</body>
</html>

View file

@ -1,31 +1,49 @@
.TH "ros-init" "1" "" "" ""
.nh \" Turn off hyphenation by default.
.PP
ros-init - Create a roswell script (optionally based on a template)
ros\-init \- Create a roswell script (optionally based on a template)
.SH Synopsis
.PP
\f[B]ros init [template]\f[] name
\f[B]ros init NAME [TEMPLATE [ARGS...]]\f[]
.TP
.B template
Specify the name of a template.
.B TEMPLATE
Specifies the name of a template, defaulted to \f[I]default\f[]
template.
However, if \f[I]TEMPLATE\f[] is not specified and \f[I]FILENAME\f[]
matches one of the templates being stored, then it automatically uses
the template.
To suppress this behavior, you should explicitly specify
\f[I]TEMPLATE\f[] as \f[I]default\f[].
.RS
.PP
Thus you are warned when you use this command from a shell script.
In order to achieve a consistent and desired behavior, it is adviced
that they should always explicitly specify the template name.
.RE
.TP
.B NAME
Specify the output filename, or "\-" to indicate \f[I]stdout\f[].
When \f[I]TEMPLATE\f[] is \f[I]default\f[], it automatically appends a
file type ".ros".
.RS
.RE
.SH Description
.PP
Initialises [name].ros.
Initialises a roswell file based on a template.
User\-specified templates can be added by \f[I]ros\-template\f[](1).
.PP
The default template is something like:
.IP
.nf
\f[C]
#!/bin/sh
#|-*-\ mode:lisp\ -*-|#
#|\ <Put\ a\ one-line\ description\ here>
exec\ ros\ -Q\ --\ $0\ "$\@"
#|\-*\-\ mode:lisp\ \-*\-|#
#|\ <Put\ a\ one\-line\ description\ here>
exec\ ros\ \-Q\ \-\-\ $0\ "$\@"
|#
(defpackage\ :ros.script.test.3666781082
\ \ (:use\ :cl))
(in-package\ :ros.script.test.3666781082)
(in\-package\ :ros.script.test.3666781082)
(defun\ main\ (&rest\ argv)
\ \ (declare\ (ignorable\ argv)))
;;;\ vim:\ set\ ft=lisp\ lisp:
@ -34,11 +52,11 @@ exec\ ros\ -Q\ --\ $0\ "$\@"
.PP
This is basically a shell script which immediately invokes Roswell by
exec (see \f[I]sh(1)\f[]).
Roswell loads the same script as an input, skips multi-line comments,
Roswell loads the same script as an input, skips multi\-line comments,
reads the rest of the file as a Common Lisp program, and finally invokes
a function main with command-line arguments.
a function main with command\-line arguments.
.SH SEE ALSO
.PP
\f[I]sbcl\f[](1) \f[I]ros\f[](1)
\f[I]sbcl\f[](1) \f[I]ros\f[](1) \f[I]ros\-template\f[](1)
.SH AUTHORS
Roswell Project Team.

View file

@ -0,0 +1,96 @@
.TH "ros-template" "1" "" "" ""
.nh \" Turn off hyphenation by default.
.SH Synopsis
.PP
\f[B]ros template\f[] [add|rm|list|show] [OPTIONS] [TEMPLATE [ARGS...]]
.PP
Register, manage and remove the templates.
.PP
The format of ARGS is same as the lambda list except the following
translation:
.IP \[bu] 2
&key, &optional, &rest corresponds to \-\-key, \-\-optional, \-\-rest,
respectively.
.IP \[bu] 2
Abbreviation as \-k, \-o, \-r are available.
.IP \[bu] 2
Each argument is separated by \-\-, instead of being surrounded by
parentheses.
.IP \[bu] 2
Optional and keyword arguments can have a default value.
When no defauilt value is specified, it implies an empty string.
.SH Examples
.PP
The following example shows how to register a template file (an asdf
system definition) named \f[I]tmpl.asd\f[], then instantiate the
template with some arguments.
.IP
.nf
\f[C]
$\ cat\ tmpl.asd
(asdf:defsystem\ NAME\ :author\ "AUTHOR"\ :depends\-on\ DEP\ :short\-description\ "library\ by\ AUTHOR.")
$\ ros\ template\ add\ tmpl.asd\ NAME\ AUTHOR\ \-\-optional\ DEP\ "(:alexandria)"
$\ ros\ init\ result.asd\ tmpl.asd\ bob\-utilities\ Bob
Successfully\ generated:\ result.asd
$\ cat\ result.asd:
(asdf:defsystem\ bob\-utilities\ :author\ "Bob"\ :depends\-on\ (:alexandria)\ :short\-description\ "library\ by\ Bob.")
\f[]
.fi
.PP
Notice the arguments are READ.
Thus you may use "#." readmacro in order to evaluate the arguments when
the template is instantiated.
For example,
.IP
.nf
\f[C]
$\ echo\ $USER
Bob
$\ ros\ init\ result.asd\ tmpl.asd\ bob\-utilities\ \[aq]#.(uiop:getenv\ "USER")\[aq]
$\ cat\ result.asd:
(asdf:defsystem\ bob\-utilities\ :author\ "Bob"\ :depends\-on\ (:alexandria)\ :short\-description\ "library\ by\ Bob.")
\f[]
.fi
.PP
The results are PRINCed, so the results are not escaped with "".
If you want the results to be escaped, it should be done in the template
(as in "AUTHOR").
.SH Subcommands
.TP
.B add
Registers a file \f[I]TEMPLATE\f[].
.RS
.RE
.TP
.B list
Shows the list of the registered templates.
.RS
.RE
.TP
.B show
Describes the contents of \f[I]TEMPLATE\f[] which is already registered.
.RS
.RE
.TP
.B rm
Ensures that a template \f[I]TEMPLATE\f[] is removed.
.RS
.RE
.SH Options for \f[I]ros template add\f[]
.IP \[bu] 2
\-f,\-\-force : Overwrites the existing template with the same name
without asking
.IP \[bu] 2
\-r,\-\-recursive : register the directory recursively.
TEMPLATE should be a directory in order to make this option meaningful.
.IP \[bu] 2
\-\-name NAME : register the template with a given name, not the
original filename.
.SH Misc
.PP
Registered templates are stored in directory $ROSWELL_HOME/templates/ .
.SH SEE ALSO
.PP
\f[I]ros\f[](1) \f[I]ros\-init\f[](1)
.SH AUTHORS
Roswell Project Team.

View file

@ -2,17 +2,30 @@ ros-init - Create a roswell script (optionally based on a template)
# Synopsis
**ros init [template]** name
**ros init NAME [TEMPLATE [ARGS...]]**
TEMPLATE
: Specifies the name of a template, defaulted to *default*
template. However, if *TEMPLATE* is not specified and *FILENAME*
matches one of the templates being stored, then it automatically uses
the template. To suppress this behavior, you should explicitly
specify *TEMPLATE* as *default*.
Thus you are warned when you use this command from a shell script. In
order to achieve a consistent and desired behavior, it is adviced that
they should always explicitly specify the template name.
NAME
: Specify the output filename, or "-" to indicate *stdout*. When *TEMPLATE* is *default*, it automatically appends a file type ".ros".
<!-- # subcommands -->
template
: Specify the name of a template.
# Description
Initialises [name].ros.
Initialises a roswell file based on a template. User-specified templates can be added by _ros-template_(1).
The default template is something like:
@ -37,5 +50,5 @@ This is basically a shell script which immediately invokes Roswell by exec (see
<!-- # Environmental Variables -->
# SEE ALSO
_sbcl_(1) _ros_(1)
_sbcl_(1) _ros_(1) _ros-template_(1)

71
documents/ros-template.md Normal file
View file

@ -0,0 +1,71 @@
# Synopsis
**ros template** [add|rm|list|show] [OPTIONS] [TEMPLATE [ARGS...]]
Register, manage and remove the templates.
The format of ARGS is same as the lambda list except the following translation:
* &key, &optional, &rest corresponds to --key, --optional, --rest, respectively.
* Abbreviation as -k, -o, -r are available.
* Each argument is separated by --, instead of being surrounded by parentheses.
* Optional and keyword arguments can have a default value. When no defauilt
value is specified, it implies an empty string.
# Examples
The following example shows how to register a template file (an asdf system definition) named *tmpl.asd*, then instantiate the template with some arguments.
```
$ cat tmpl.asd
(asdf:defsystem NAME :author "AUTHOR" :depends-on DEP :short-description "library by AUTHOR.")
$ ros template add tmpl.asd NAME AUTHOR --optional DEP "(:alexandria)"
$ ros init result.asd tmpl.asd bob-utilities Bob
Successfully generated: result.asd
$ cat result.asd:
(asdf:defsystem bob-utilities :author "Bob" :depends-on (:alexandria) :short-description "library by Bob.")
```
Notice the arguments are READ. Thus you may use "#." readmacro in order to evaluate the
arguments when the template is instantiated. For example,
```
$ echo $USER
Bob
$ ros init result.asd tmpl.asd bob-utilities '#.(uiop:getenv "USER")'
$ cat result.asd:
(asdf:defsystem bob-utilities :author "Bob" :depends-on (:alexandria) :short-description "library by Bob.")
```
The results are PRINCed, so the results are not escaped with "".
If you want the results to be escaped, it should be done in the template (as in "AUTHOR").
# Subcommands
add
: Registers a file *TEMPLATE*.
list
: Shows the list of the registered templates.
show
: Describes the contents of *TEMPLATE* which is already registered.
rm
: Ensures that a template *TEMPLATE* is removed.
# Options for *ros template add*
* -f,--force : Overwrites the existing template with the same name without asking
* -r,--recursive : register the directory recursively. TEMPLATE should be a directory in order to make this option meaningful.
* --name NAME : register the template with a given name, not the original filename.
# Misc
Registered templates are stored in directory $ROSWELL_HOME/templates/ .
# SEE ALSO
_ros_(1)
_ros-init_(1)