scriptinfo [options] scriptname |
-h|--help | print short help and exit |
-H|--Help | print full documentation and exit |
-V|--version | print version and exit |
-b|--brief | print brief output for usage in scripts |
-n|--nocolor | print without ANSI coloring sequences |
-m|--markdown | use markdown for github-compatible output |
-o|--options | list the options and exits |
gendoc
documentation, scriptinfo prints the script's short description, type, author, authors email, version, license and intro. If the script has no path information and is not found, it is looked up in PATH.
=␣<scriptname>␣-␣
=␣Author
.
version = 1.23 $version = 1.23 my $version = 1.23 version => 1.23a version = "1.23" version = '1.23d'
Whitespace in these formats may be arbirarily long or absent, including at the start of the line, anything may follow at the end, but a single lower letter will be part of the version number.
=␣Copyright
.
The output of scriptinfo comes in three formats. The default is the long format, which for scriptinfo itself is like this:
script: scriptinfo - for a gendoc-documented script, print concise info type: bash author: Wybo Dekker email: wybo@dekkerdocumenten.nl version: 1.08 license: GNU General Public License v3.0 -------------------------------------------------------------------------------- For a script with |gendoc| documentation, scriptinfo prints the script's short description, type, author, authors email, version, license and intro.
Without the --nocolor
option some keywords will be ANSI colored.
With the --brief
option, exactly 3 lines are output, one for each of short description, type, version. This is the output used by the instscript and gendoc scripts. For scriptinfo itself it looks like this:
for a gendoc-documented script, print concise info bash 1.08
With the --markdown
option, a markdown version is produced, which is useful as a README file for github uploads. This option disables the --brief
option and sets the --nocolor
option. The output for scriptinfo itself is:
# scriptinfo | key | description | ---:|:--- | script | scriptinfo - for a gendoc-documented script, print concise info | type | bash | author | Wybo Dekker | email | wybo@dekkerdocumenten.nl | version | 1.08 | license | GNU General Public License
For a script with gendoc documentation, scriptinfo prints the script's short description, type, author, authors email, version, license and intro.
The --options
option is useful when writing the documentation for a shell script. When the option handler contains lines like these:
(-n|--nothing)# this option does nothing (-o|--output)# set output file name to X
then the command:
scriptinfo -o scriptwill generate lines like this:
-n,--nothing | # this option does nothing |
-o,--output=X | # set output file name to X |
which can be inserted in the documentation. Note that the single character X, when it occurs in the comment line(s), is considered to be an argument of the option.
When you are editing the script with vim, you can insert such lines by giving the ex-command:
:r!scriptinfo -o %
-V
option, which must have been programmed, of course.
synopsis: | handle_options "$@" |
description: | handle the options. |
globals used: | Myname Version |
globals set: | args brief markdown listoptions |
synopsis: | listopts script |
description: | list the options of the script, like its -h option would. |
For a Bash script, its option handler analyzed. Ruby's option handler, used by the scripts -h option. | |
globals used: | script s d w type |
globals set: |