[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] xm support for abbreviated commands


  • To: xen-devel@xxxxxxxxxxxxxxxxxxx
  • From: Tom Wilkie <tw275@xxxxxxxxx>
  • Date: Wed, 10 Aug 2005 14:02:35 +0100
  • Delivery-date: Wed, 10 Aug 2005 13:01:02 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xensource.com>

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
diff -r 50e57636bdd8 tools/python/xen/xm/main.py
--- a/tools/python/xen/xm/main.py       Wed Aug 10 12:21:39 2005
+++ b/tools/python/xen/xm/main.py       Wed Aug 10 13:59:44 2005
@@ -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
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.