All of lore.kernel.org
 help / color / mirror / Atom feed
* xm support for abbreviated commands
@ 2005-08-10 13:02 Tom Wilkie
  0 siblings, 0 replies; only message in thread
From: Tom Wilkie @ 2005-08-10 13:02 UTC (permalink / raw)
  To: xen-devel

[-- Attachment #1: Type: text/plain, Size: 224 bytes --]

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

[-- Attachment #2: xm-abv.diff --]
[-- Type: text/x-patch, Size: 581 bytes --]

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()
 

[-- Attachment #3: Type: text/plain, Size: 138 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2005-08-10 13:02 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-08-10 13:02 xm support for abbreviated commands Tom Wilkie

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.