[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen-unstable] Improve xm shell tab completion.
# HG changeset patch # User Ewan Mellor <ewan@xxxxxxxxxxxxx> # Date 1173544698 0 # Node ID d09da90db166c177113d7641ae919a507bed44d1 # Parent 7e66858aa8111d1a5feaa257e0fbe66866bb832c Improve xm shell tab completion. Signed-off-by: Ewan Mellor <ewan@xxxxxxxxxxxxx> --- tools/python/xen/xm/main.py | 11 ++++++++--- 1 files changed, 8 insertions(+), 3 deletions(-) diff -r 7e66858aa811 -r d09da90db166 tools/python/xen/xm/main.py --- a/tools/python/xen/xm/main.py Sat Mar 10 14:57:11 2007 +0000 +++ b/tools/python/xen/xm/main.py Sat Mar 10 16:38:18 2007 +0000 @@ -25,6 +25,7 @@ import cmd import cmd import os import pprint +import readline import shlex import sys import re @@ -558,6 +559,10 @@ class Shell(cmd.Cmd): for f in res: setattr(Shell, 'do_' + f, self.default) + def preloop(self): + cmd.Cmd.preloop(self) + readline.set_completer_delims(' ') + def default(self, line): words = shlex.split(line) if len(words) > 0 and words[0] == 'xm': @@ -577,9 +582,9 @@ class Shell(cmd.Cmd): return False def completedefault(self, text, line, begidx, endidx): - cmd = line.split(' ')[0] - clas, func = cmd.split('.') - if begidx != len(cmd) + 1 or \ + words = shlex.split(line[:begidx]) + clas, func = words[0].split('.') + if len(words) > 1 or \ func.startswith('get_by_') or \ func == 'get_all': return [] _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |