mirror of
https://git.launchpad.net/~ubuntu-release/britney/+git/britney2-ubuntu
synced 2025-03-10 10:51:08 +00:00
Completer: when processing a "remove", only offer packages from testing
Signed-off-by: Adam D. Barratt <adam@adam-barratt.org.uk>
This commit is contained in:
parent
45fef5e4d5
commit
a69d450c38
16
completer.py
16
completer.py
@ -50,7 +50,9 @@ class Completer(object):
|
||||
name = "%s/%s" % (e.name, britney.sources[suite][pkg][0]) # 0 == VERSION
|
||||
complete.append(name)
|
||||
self.packages = sorted(complete)
|
||||
|
||||
testing = britney.sources['testing']
|
||||
self.testing_packages = sorted("%s/%s" % (pkg, testing[pkg][0]) for pkg in testing)
|
||||
|
||||
def completer(self, text, state):
|
||||
"""readline completer (see the readline API)"""
|
||||
|
||||
@ -64,11 +66,15 @@ class Completer(object):
|
||||
self.matches = [x for x in self.cmds if x.startswith(text)]
|
||||
else:
|
||||
# complete pkg/[arch/]version
|
||||
start = bisect.bisect_left(self.packages, text)
|
||||
while start < len(self.packages):
|
||||
if not self.packages[start].startswith(text):
|
||||
if words[0] == 'remove':
|
||||
packages = self.testing_packages
|
||||
else:
|
||||
packages = self.packages
|
||||
start = bisect.bisect_left(packages, text)
|
||||
while start < len(packages):
|
||||
if not packages[start].startswith(text):
|
||||
break
|
||||
self.matches.append(self.packages[start])
|
||||
self.matches.append(packages[start])
|
||||
start += 1
|
||||
|
||||
if len(self.matches) > state:
|
||||
|
Loading…
x
Reference in New Issue
Block a user