Skip to contentSkip to conversation

xm support for abbreviated commands

PATCH Tom Wilkie 1 participant 1 message Aug 10, 2005

lore
Share & tools
lore

Tom Wilkie

author
#0 lore raw

This patch adds support for abbreviated commands to xm.

Eg xm li -> xm list, for all those people where typing 'st' will kill them

It makes sure the abbreviated command is not ambiguous, and at least 2 letters long.

Tom

tools/python/xen/xm/main.py +4 -0
diff -r 50e57636bdd8 tools/python/xen/xm/main.py
@@ -605,6 +605,10 @@
         deprecated(cmd,aliases[cmd])
         return commands[aliases[cmd]]
     else:
+        if len( cmd ) > 1:
+            matched_commands = filter( lambda (command, func): command[ 0:len(cmd) ] == cmd, commands.iteritems() )
+            if len( matched_commands ) == 1:
+                return matched_commands[0][1]
         err('Sub Command %s not found!' % cmd)
         usage()
 

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel