Skip to content

Latest commit

 

History

History
37 lines (32 loc) · 3.25 KB

version_messages.md

File metadata and controls

37 lines (32 loc) · 3.25 KB

5.8. Version messages

Besides the ARGPARSER_HELP_OPTIONS and the ARGPARSER_USAGE_OPTIONS, 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 many 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 🡆