summaryrefslogtreecommitdiffstats
path: root/bin/check-new-issues
diff options
context:
space:
mode:
authorRaphael Geissert <geissert@debian.org>2017-10-12 19:58:56 +0000
committerRaphael Geissert <geissert@debian.org>2017-10-12 19:58:56 +0000
commitafbe5e14a454864c69f156ffbb24e7eed140d60b (patch)
tree404bae2f86166bc294ee697f0deeb97c87340c1a /bin/check-new-issues
parent3f86eb5aa6862c9ad64c5fa3b79f4d71ff9c228e (diff)
poor-man's pkg name completion
only based on package names already seen in the list, at this time git-svn-id: svn+ssh://svn.debian.org/svn/secure-testing@56663 e39458fd-73e7-0310-bf30-c45bca0a0e42
Diffstat (limited to 'bin/check-new-issues')
-rwxr-xr-xbin/check-new-issues28
1 files changed, 27 insertions, 1 deletions
diff --git a/bin/check-new-issues b/bin/check-new-issues
index fd5690504f..bebbfa3a74 100755
--- a/bin/check-new-issues
+++ b/bin/check-new-issues
@@ -144,6 +144,8 @@ if ($opts{u} || $opts{U}) {
$ignore_missing_bug{$_} = 1 for @ignore_missing_bug_list;
}
+my %seen_pkgs;
+
foreach my $entry (@{$entries}) {
my $name;
if ( $entry =~ /^(CVE-....-\d{4,})/ ) {
@@ -155,6 +157,14 @@ foreach my $entry (@{$entries}) {
else {
die "invlid entry:\n$entry";
}
+ if (!$opts{l} && $entry =~ /^\s+-\s+([^\s]+)/m ) {
+ my $pkg = $1;
+ my $fc = substr($pkg, 0, 1);
+
+ $seen_pkgs{$fc} = {}
+ unless (exists($seen_pkgs{$fc}));
+ $seen_pkgs{$fc}{$pkg} = undef;
+ }
$data->{$name}->{entry}=\$entry;
if ($name =~ /$issue_regexp/) {
if (!$opts{U} && $entry =~ /$todo_regexp/m ) {
@@ -211,7 +221,7 @@ if ($term->ReadLine() eq 'Term::ReadLine::Stub') {
my $attribs = $term->Attribs;
-$attribs->{completion_word} = [ qw(.f .c .w .m .r ! v e - .help q) ];
+my @completion_commands = qw(.f .c .w .m .r ! v e - .help q);
sub initial_completion {
my ($text, $line, $start, $end) = @_;
@@ -221,12 +231,28 @@ sub initial_completion {
# If first word then complete commands
if ($start == 0) {
+ $attribs->{completion_word} = \@completion_commands;
+
# do not add useless blank spaces on completion
$attribs->{completion_suppress_append} = 1
unless ($line eq '-');
return $term->completion_matches($text,
$attribs->{list_completion_function});
+ } elsif ($line =~ /^-\s+(.)?/) {
+ my $fc = $1;
+
+ if (length($fc) == 0) {
+ $attribs->{completion_suppress_append} = 1;
+ $attribs->{completion_word} = [ keys %seen_pkgs ];
+ } elsif (exists($seen_pkgs{$fc})) {
+ $attribs->{completion_word} = [ keys %{$seen_pkgs{$fc}} ];
+ } else {
+ $attribs->{completion_word} = [];
+ }
+
+ return $term->completion_matches($text,
+ $attribs->{list_completion_function});
} else {
return;
}

© 2014-2024 Faster IT GmbH | imprint | privacy policy