summaryrefslogtreecommitdiffstats
path: root/ogcli
diff options
context:
space:
mode:
Diffstat (limited to 'ogcli')
-rwxr-xr-xogcli10
1 files changed, 8 insertions, 2 deletions
diff --git a/ogcli b/ogcli
index 078a07e..4adc5cf 100755
--- a/ogcli
+++ b/ogcli
@@ -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:])