Skip to content

Unhelpful output when option is incorrect #160

@matsduf

Description

@matsduf

If you use an incorrect option, say --show-module instead of --show-module you get a very long output that hides the error message, as below. Instead, a short message is enough and makes it easier to read.

Proposed output:

# zonemaster-cli --show-module zonemaster.net --no-ipv6                                   
Unknown option: show-module
Run "zonemaster-cli -h" to get the valid options
# 

Output today:

# zonemaster-cli --show-module zonemaster.net --no-ipv6                                   
Unknown option: show-module
usage: zonemaster-cli [-?h] [long options...]
	-h -? --usage --help   Prints this usage information.
	--[no-]version         Print version information and exit.
	--level STR            The minimum severity level to display. Must be
	                       one of CRITICAL, ERROR, WARNING, NOTICE, INFO
	                       or DEBUG.
	--locale STR           The locale to use for messages translation.
	--[no-]json            Flag indicating if output should be in JSON or
	                       not.
	--[no-]json_stream     Flag indicating if output should be streaming
	                       JSON or not.
	--[no-]json_translate  Flag indicating if streaming JSON output
	                       should include the translated message of the
	                       tag or not.
	--[no-]raw             Flag indicating if output should be translated
	                       to human language or dumped raw.
	--[no-]time            Print timestamp on entries.
	--[no-]show_level      Print level on entries.
	--[no-]show_module     Print the name of the module on entries.
	--[no-]show_testcase   Print the name of the test case (method) on
	                       entries.
	--ns STR...            A name/ip string giving a nameserver for
	                       undelegated tests, or just a name which will
	                       be looked up for IP addresses. Can be given
	                       multiple times.
	--save STR             Name of a file to save DNS data to after
	                       running tests.
	--restore STR          Name of a file to restore DNS data from before
	                       running test.
	--[no-]ipv4            Flag to permit or deny queries being sent via
	                       IPv4. --ipv4 permits IPv4 traffic, --no-ipv4
	                       forbids it.
	--[no-]ipv6            Flag to permit or deny queries being sent via
	                       IPv6. --ipv6 permits IPv6 traffic, --no-ipv6
	                       forbids it.
	--[no-]list_tests      Instead of running a test, list all available
	                       tests.
	--test STR...          Specify test to run. Should be either the name
	                       of a module, or the name of a module and the
	                       name of a method in that module separated by a
	                       "/" character (Example: "Basic/basic1"). The
	                       method specified must be one that takes a zone
	                       object as its single argument. This switch can
	                       be repeated.
	--stop_level STR       As soon as a message at this level or higher
	                       is logged, execution will stop. Must be one of
	                       CRITICAL, ERROR, WARNING, NOTICE, INFO or
	                       DEBUG.
	--profile STR          Name of profile file to load. (DEFAULT)
	--config STR           Name of configuration file to load.
	                       (TERMINATED)
	--policy STR           Name of policy file to load. (TERMINATED)
	--ds STR...            Strings with DS data on the form
	                       "keytag,algorithm,type,digest"
	--[no-]count           Print a count of the number of messages at
	                       each level
	--[no-]progress        Boolean flag for activity indicator. Defaults
	                       to on if STDOUT is a tty, off if it is not.
	                       Disable with --noprogress.
	--encoding STR         Name of the character encoding used for
	                       command line arguments
	--[no-]nstimes         At the end of a run, print a summary of the
	                       times the zone's name servers took to answer.
	--[no-]dump_profile    Print the effective profile used in JSON
	                       format, then exit.
	--[no-]dump_config     Print the effective configuration used in JSON
	                       format, then exit. (TERMINATED)
	--[no-]dump_policy     Print the effective policy used in JSON
	                       format, then exit. (TERMINATED)
	--sourceaddr STR       Local IP address that the test engine should
	                       try to send its requests from.
	--[no-]elapsed         Print elapsed time at end of run.
# 

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions