From mboxrd@z Thu Jan 1 00:00:00 1970 From: Tom Wilkie Subject: xm support for abbreviated commands Date: Wed, 10 Aug 2005 14:02:35 +0100 Message-ID: <42F9FAEB.5090603@cam.ac.uk> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------060408020808080901020808" Return-path: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org This is a multi-part message in MIME format. --------------060408020808080901020808 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit 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 --------------060408020808080901020808 Content-Type: text/x-patch; name="xm-abv.diff" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="xm-abv.diff" 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() --------------060408020808080901020808 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel --------------060408020808080901020808--