zonemaster-cli icon indicating copy to clipboard operation
zonemaster-cli copied to clipboard

zonemaster-cli: disallow CLI options that do not make sense together

Open marc-vanderwal opened this issue 1 year ago • 1 comments

There are combinations of command-line options to zonemaster-cli that do not make sense together, and should be rejected as usage errors.

Some examples:

  • A command line such as zonemaster-cli --help --list-tests --version --dump-profile doesn’t make sense at all, because all of these options select different modes. Any two of these options combined together should be rejected as an invalid command line.

  • In the synopsis, one line says zonemaster-cli [OPTIONS] --dump-profile. Because --dump-profile selects a different mode than the default one, there is just a small subset of OPTIONS that do make sense with --dump-profile. Which ones are acceptable, besides --profile=FILE? Combinations, such as the somewhat silly zonemaster-cli --dump-profile --no-json (because the --no-json applies to the output of zone testing and not profile dumps), should be rejected.

  • The error messages displayed on erroneous values for --level and --stop-level are inconsistent:

$ zonemaster-cli --stop-level=INVALID
Failed to recognize stop level 'INVALID'.
$ zonemaster-cli --level=INVALID
--level must be one of CRITICAL, ERROR, WARNING, NOTICE, INFO, DEBUG, DEBUG2 or DEBUG3.

marc-vanderwal avatar Dec 03 '24 10:12 marc-vanderwal

Relates to #146

tgreenx avatar Feb 26 '25 17:02 tgreenx