aboutsummaryrefslogtreecommitdiffstats
path: root/libbe/command/base.py
diff options
context:
space:
mode:
authorW. Trevor King <wking@drexel.edu>2009-12-31 15:33:39 -0500
committerW. Trevor King <wking@drexel.edu>2009-12-31 15:33:39 -0500
commit2d1562d951e763fed71fe60e77cc9921be9abdc9 (patch)
treece242a439dbc6f950853364355f9c8d5d1275095 /libbe/command/base.py
parentaacf928c27da30856a6e15b2ec7778f5707504ea (diff)
downloadbugseverywhere-2d1562d951e763fed71fe60e77cc9921be9abdc9.tar.gz
Use fragment in base command completion + command io fixups.
Diffstat (limited to 'libbe/command/base.py')
-rw-r--r--libbe/command/base.py16
1 files changed, 11 insertions, 5 deletions
diff --git a/libbe/command/base.py b/libbe/command/base.py
index 357940f..2f0ccc6 100644
--- a/libbe/command/base.py
+++ b/libbe/command/base.py
@@ -294,7 +294,7 @@ class Command (object):
if argument == None:
ret = ['--%s' % o.name for o in self.options]
if len(self.args) > 0 and self.args[0].completion_callback != None:
- ret.extend(self.args[0].completion_callback(self, argument))
+ ret.extend(self.args[0].completion_callback(self, argument, fragment))
return ret
elif argument.completion_callback != None:
# finish a particular argument
@@ -486,12 +486,18 @@ class UserInterface (object):
raise NotImplementedError
def run(self, command, options=None, args=None):
- command.ui = self
- self.io.setup_command(command)
- self.storage_callbacks.setup_command(command)
+ self.setup_command(command)
+ return command.run(options, args)
+
+ def setup_command(self, command):
+ if command.ui == None:
+ command.ui = self
+ if self.io != None:
+ self.io.setup_command(command)
+ if self.storage_callbacks != None:
+ self.storage_callbacks.setup_command(command)
command.restrict_file_access = self.restrict_file_access
command._get_user_id = self._get_user_id
- return command.run(options, args)
def _get_user_id(self):
"""Callback for use by commands that need it."""