You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -296,6 +298,7 @@ Typically, you generate bash completion ``my-script.sh`` from the generated scri
296
298
297
299
and you move the created completion file ``my-script.sh`` to ``/etc/bash_completion.d/`` directory.
298
300
301
+
299
302
.. _docopt_output:
300
303
301
304
Docopt help message
@@ -315,6 +318,27 @@ Typically, you generate docopt output to the standard output from the generated
315
318
$ argbash my-script --type docopt --strip all
316
319
317
320
321
+
Manpage output
322
+
++++++++++++++
323
+
324
+
Argbash can generate source for the manual page for your script.
325
+
There are two files in the process --- the template, and definitions.
326
+
Those two files are in the `reStructuredText <http://docutils.sourceforge.net/rst.html>`_ format, and the template is supposed to be processed by the `rst2man <http://docutils.sourceforge.net/sandbox/manpage-writer/rst2man.txt>`_ utility.
327
+
328
+
The manpage template is supposed to be generated as script's metadata change, definitions are required to be maintained manually, as they are supposed to contain content that is not present in the script.
329
+
You can regenerate the template using the ``manpage`` output, while you are probably going to use the ``manpage-defs`` once to get you kickstarted and then continue to maintain it manually.
330
+
331
+
So given a argbash-powered script or m4 file, your manpage workflow will typically look like this:
332
+
333
+
.. code-block:: shell-session
334
+
335
+
$ argbash my-script --type manpage-defs --strip all -o my-script-defs.rst
336
+
$ argbash my-script --type manpage --strip all -o my-script.rst
337
+
$ vim my-script-defs.rst # Edit the definitions file
Argbash is a code generator that typically generates a bash argument-parsing library tailor-made for your script.
8
+
It lets you to describe arguments your script should take and then, you can generate the ``bash`` parsing code.
9
+
It stays in your script by default, but you can have it generated to a separate file and let ``bash`` to include it in your script for you.
10
+
``Argbash`` is very simple to use and the generated code is relatively nice to read.
11
+
Moreover, argument definitions stay embedded in the script, so when you need to update the parsing logic, you just re-run the ``argbash`` script on the already generated script.
12
+
13
+
.. |OPTION_OUTPUT| replace:: \
14
+
15
+
.. |OPTION_TYPE| replace:: Check out the documentation to learn about all argbash capabilities that are supported.
16
+
17
+
.. |OPTION_LIBRARY| replace:: This option is deprecated and it is the same as ``--strip user-content``.
18
+
19
+
.. |OPTION_STRIP| replace::
20
+
You can either strip ``none``, which is useful for scripts.
21
+
If you strip ``user-content``, you keep the Argbash header.
22
+
If you strip ``all``, you will have only the generated content in the result.
0 commit comments