print usage message for unknown command

This commit is contained in:
Brian O'Connor
2013-09-11 12:00:15 -07:00
parent b55806017a
commit e9a835ac55
+5 -6
View File
@@ -323,14 +323,13 @@ class CLI( Cmd ):
corresponding IP addrs."""
first, args, line = self.parseline( line )
if not args:
return
if args and len(args) > 0 and args[ -1 ] == '\n':
args = args[ :-1 ]
rest = args.split( ' ' )
if first in self.mn:
if not args:
print "*** Enter a command for node: %s <cmd>" % first
return
node = self.mn[ first ]
rest = args.split( ' ' )
# Substitute IP addresses for node names in command
rest = [ self.mn[ arg ].defaultIntf().updateIP()
if arg in self.mn else arg
@@ -341,7 +340,7 @@ class CLI( Cmd ):
node.sendCmd( rest, printPid=( not builtin ) )
self.waitForNode( node )
else:
error( '*** Unknown command: %s\n' % first )
error( '*** Unknown command: %s\n' % line )
# pylint: enable-msg=R0201