Skip to contentSkip to conversation

Fix help message printing function

PATCH New Masaki Kanno 1 participant 1 message Oct 3, 2006

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix help message printing function

Hi,

When I tested xm commands by short spell, I found a wrong behaviour in help message printing function. If xm commands by full spell, the help message of the command is printed. But, if xm commands by short spell, the short help message is printed.

# xm li No-exist-vm
Error: Domain 'No-exist-vm' does not exist.
Usage: xm <subcommand> [args]

Control, list, and manipulate Xen guest instances.

Common 'xm' commands:

console Attach to <Domain>'s console.
create Create a domain based on <ConfigFile>.
(snip)

# xm list No-exist-vm
Error: Domain 'No-exist-vm' does not exist.
Usage: xm list [options] [Domain, ...]

List information about all/some domains.
-l, --long Output all VM details in SXP
--label Include security labels

This patch fixes the wrong behaviour.

# xm li No-exist-vm
Error: Domain 'No-exist-vm' does not exist.
Usage: xm list [options] [Domain, ...]

List information about all/some domains.
-l, --long Output all VM details in SXP
--label Include security labels

# xm list No-exist-vm
Error: Domain 'No-exist-vm' does not exist.
Usage: xm list [options] [Domain, ...]

List information about all/some domains.
-l, --long Output all VM details in SXP
--label Include security labels

Best regards,
Kan

tools/python/xen/xm/main.py +5 -0
diff -r f426f6e646eb tools/python/xen/xm/main.py
@@ -290,6 +290,11 @@ all_commands = (domain_commands + host_c
 
 def cmdHelp(cmd):
     """Print help for a specific subcommand."""
+    
+    for fc in SUBCOMMAND_HELP.keys():
+        if fc[:len(cmd)] == cmd:
+            cmd = fc
+            break
     
     try:
         args, desc = SUBCOMMAND_HELP[cmd]

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