diff options
-rwxr-xr-x | ogcli | 10 |
1 files changed, 8 insertions, 2 deletions
@@ -42,9 +42,15 @@ class CLI(): if not attr.startswith('_')]) args = parser.parse_args(sys.argv[1:2]) + if args.command is None: + print('Missing subcommand', file=sys.stderr) + parser.print_help(file=sys.stderr) + sys.exit(1) + if not hasattr(self.ogcli, args.command): - parser.print_help() - sys.exit('Unknown command') + print('Invalid subcommand', file=sys.stderr) + parser.print_help(file=sys.stderr) + sys.exit(1) # Call the command with the same name. getattr(self.ogcli, args.command)(sys.argv[2:]) |