bitkeeper revision 1.1108.2.2 (40fbf4de21Jj1rHIoB288QJ0sKILVg)

Tweak xm command parsing - can now use unambiguous prefixes to identify the
command.  For instance: 'xm list' can be 'xm l' 'xm li' 'xm lis'.
This commit is contained in:
mwilli2@equilibrium.research.intel-research.net committed 2004-07-19 16:20:46 +00:00
1 parent 13b4d9fade
commit d477bafaa1
1 file changed
+16 -1
+16 -1
View File
@@ -105,8 +105,23 @@ class Xm:
def getprog(self, name, val=None):
"""Get a sub-program.
name Name of the sub-program (or optionally, an unambiguous
prefix of its name)
val Default return value if no (unique) match is found
"""
return self.progs.get(name, val)
match = None
for progname in self.progs.keys():
if progname == name:
match = progname
break
if progname.startswith(name):
if not match:
match = progname
else:
return val # name is ambiguous - bail out
return self.progs.get(match, val)
def proglist(self):
"""Get a list of sub-programs, ordered by group.
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.