mirror of
https://git.launchpad.net/~ubuntu-release/britney/+git/britney2-ubuntu
synced 2025-05-17 21:41:30 +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
|
name = "%s/%s" % (e.name, britney.sources[suite][pkg][0]) # 0 == VERSION
|
||||||
complete.append(name)
|
complete.append(name)
|
||||||
self.packages = sorted(complete)
|
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):
|
def completer(self, text, state):
|
||||||
"""readline completer (see the readline API)"""
|
"""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)]
|
self.matches = [x for x in self.cmds if x.startswith(text)]
|
||||||
else:
|
else:
|
||||||
# complete pkg/[arch/]version
|
# complete pkg/[arch/]version
|
||||||
start = bisect.bisect_left(self.packages, text)
|
if words[0] == 'remove':
|
||||||
while start < len(self.packages):
|
packages = self.testing_packages
|
||||||
if not self.packages[start].startswith(text):
|
else:
|
||||||
|
packages = self.packages
|
||||||
|
start = bisect.bisect_left(packages, text)
|
||||||
|
while start < len(packages):
|
||||||
|
if not packages[start].startswith(text):
|
||||||
break
|
break
|
||||||
self.matches.append(self.packages[start])
|
self.matches.append(packages[start])
|
||||||
start += 1
|
start += 1
|
||||||
|
|
||||||
if len(self.matches) > state:
|
if len(self.matches) > state:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user