scriptinfo for a gendoc-documented script, print concise info
doc generated from the script with gendoc
bash script, version=1.10

Synopsis

scriptinfo [options] scriptname

Options

-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

Description

For a script with 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.

    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.

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 script
will 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 %

C binaries

My C binaries are compiled from bash scripts that copy their gendoc documentation into the C-source as text for the -h option; by inserting a newline before the text it is ensured that all lines can be grepped from the binary. The version information is not in these lines: it is obtained by running the binary with the -V option, which must have been programmed, of course.

Author

Wybo Dekker

Copyright

Released under the GNU General Public License

See also

gendoc(1), instscript(1)

Functions used:


handle_options

synopsis:
handle_options "$@"
description:
handle the options.
globals used:
Myname Version
globals  set:
args brief markdown listoptions

listopts

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: