WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] xm support for abbreviated commands

To: xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-devel] xm support for abbreviated commands
From: Tom Wilkie <tw275@xxxxxxxxx>
Date: Wed, 10 Aug 2005 14:02:35 +0100
Delivery-date: Wed, 10 Aug 2005 13:01:02 +0000
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mozilla Thunderbird 1.0.2-1.4.1.centos4 (X11/20050323)
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
<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-devel] xm support for abbreviated commands, Tom Wilkie <=