Skip to content

Commit

Permalink
fix: call without --list failed
Browse files Browse the repository at this point in the history
If doctor was called without `--list` it would print an error that
`--show` was given but not `--list`.

This commit fixes that by setting `--show` to `None` by default and
then setting the default value if it was not set.
  • Loading branch information
mkindahl committed Dec 8, 2023
1 parent b5e6f82 commit 2819d42
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/doctor/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def parse_arguments():
help=("List rules matching pattern. "
"If no pattern is given, will list all rules"))
parser.add_argument(
'--show', choices=['brief', 'message', 'details'], default="brief",
'--show', choices=['brief', 'message', 'details'], default=None,
help=("What to show from the rule. The brief description is always shown, "
"but it is possible to show the message and the detailed message as "
"well.")
Expand All @@ -61,6 +61,8 @@ def main():
if args.show and 'list' not in args:
parser.error("called with '--show' but without '--list'")
elif 'list' in args:
if args.show is None:
args.show = 'brief'
list_rules(args.list, args.show)
else:
check_rules(user=args.user, dbname=args.dbname, port=args.port, host=args.host)

0 comments on commit 2819d42

Please sign in to comment.