Commit 845e7fb6 authored by Marco Mariani's avatar Marco Mariani

cli: better message for 'command not found'

parent ae837389
...@@ -29,7 +29,8 @@ class SlapOSCommandManager(cliff.commandmanager.CommandManager): ...@@ -29,7 +29,8 @@ class SlapOSCommandManager(cliff.commandmanager.CommandManager):
name = '' name = ''
while search_args: while search_args:
if search_args[0].startswith('-'): if search_args[0].startswith('-'):
raise ValueError('Invalid command %r' % search_args[0]) LOG.critical('slapos: invalid option %r' % search_args[0])
sys.exit(5)
next_val = search_args.pop(0) next_val = search_args.pop(0)
name = '%s %s' % (name, next_val) if name else next_val name = '%s %s' % (name, next_val) if name else next_val
if name in self.commands: if name in self.commands:
...@@ -37,9 +38,13 @@ class SlapOSCommandManager(cliff.commandmanager.CommandManager): ...@@ -37,9 +38,13 @@ class SlapOSCommandManager(cliff.commandmanager.CommandManager):
cmd_factory = cmd_ep.load() cmd_factory = cmd_ep.load()
return (cmd_factory, name, search_args) return (cmd_factory, name, search_args)
else: else:
print >>sys.stderr, ('The command %r does not exist or is not yet implemented.\n' LOG.critical('slapos: the command %r does not exist or is not yet implemented.\n'
'Please have a look at http://community.slapos.org to read documentation or forum.\n' '\n'
'Please also make sure that SlapOS Node is up to date.' % (argv,)) 'Available commands: %s\n\n'
'Please find documentation and forum at http://community.slapos.org\n'
'Please also make sure that the SlapOS Node package is up to date.',
' '.join(argv),
', '.join(sorted(repr(c) for c in self.commands)))
sys.exit(5) sys.exit(5)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment