Skip to content

Latest commit

 

History

History
35 lines (30 loc) · 3.22 KB

File metadata and controls

35 lines (30 loc) · 3.22 KB

5.8. Version messages

Besides the ARGPARSER_HELP_OPTIONS, --help, the ARGPARSER_USAGE_OPTIONS, and --usage, there is a third option intended to help the user, the ARGPARSER_VERSION_OPTIONS (default: -V) and --version. This flag compiles a brief version message for your script, showing its canonical name (the ARGPARSER_SCRIPT_NAME) and the version number (the ARGPARSER_VERSION_NUMBER). Just as for the help and usage messages, you can disable the version message (and its corresponding flags) by setting ARGPARSER_ADD_VERSION to false. Note that the default short option name is an uppercase "V", such that you can use the lowercase "v" (as -v) for your purposes, like --verbatim or --verbose. This is in line with the common behavior of command-line programs. By setting ARGPARSER_VERSION_OPTIONS accordingly, you can of course change it to your needs, if desired.

The output version message is very simple:

$ bash ../tutorial/try_argparser.sh -V
Version: try_argparser.sh v1.0.0

🡄 5.7. Help and usage message localization           5.9. Error and warning messages 🡆