From e9a835ac55d19f59ad61ee95e23ea18b74b2410b Mon Sep 17 00:00:00 2001 From: Brian O'Connor Date: Tue, 27 Aug 2013 13:58:23 -0700 Subject: [PATCH] print usage message for unknown command --- mininet/cli.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/mininet/cli.py b/mininet/cli.py index 5de9beb..3ca190f 100644 --- a/mininet/cli.py +++ b/mininet/cli.py @@ -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 " % 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