diff options
author | Raphael Geissert <geissert@debian.org> | 2017-10-11 10:11:09 +0000 |
---|---|---|
committer | Raphael Geissert <geissert@debian.org> | 2017-10-11 10:11:09 +0000 |
commit | a4617d15a185b095cfd20ff99b601f76678fc7f9 (patch) | |
tree | f6ff57ae296836f242d5f06fb218a48e403b242f /bin/check-new-issues | |
parent | 08c568918bf8a13ff23a6171ccca63d3649ecb72 (diff) |
Add command completion
git-svn-id: svn+ssh://svn.debian.org/svn/secure-testing@56604 e39458fd-73e7-0310-bf30-c45bca0a0e42
Diffstat (limited to 'bin/check-new-issues')
-rwxr-xr-x | bin/check-new-issues | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/bin/check-new-issues b/bin/check-new-issues index 99699f70a8..314824cfeb 100755 --- a/bin/check-new-issues +++ b/bin/check-new-issues @@ -209,6 +209,27 @@ if ($term->ReadLine() eq 'Term::ReadLine::Stub') { print "Install libterm-readline-gnu-perl to get readline support!\n"; } +my $attribs = $term->Attribs; + +$attribs->{completion_word} = [ qw(.f .c .w .m .r ! v e - .help q) ]; + +sub initial_completion { + my ($text, $line, $start, $end) = @_; + + $attribs->{attempted_completion_over} = 1; + + + # If first word then complete commands + if (substr($line, 0, $start) =~ /^\s*[.]?$/) { + return $term->completion_matches($text, + $attribs->{list_completion_function}); + } else { + return; + } +} + +$attribs->{attempted_completion_function} = \&initial_completion; + TODO: foreach my $todo (reverse sort @todos) { print ${$data->{$todo}->{CVE}} if $data->{$todo}->{CVE}; print ${$data->{$todo}->{entry}}; @@ -272,10 +293,10 @@ TODO: foreach my $todo (reverse sort @todos) { print "exit status: $?\n"; next READ; } - elsif ($r=~ /^q$/i ) { + elsif ($r=~ /^q\s?$/i ) { last TODO; } - elsif ($r=~ /^[ve]$/i ) { + elsif ($r=~ /^[ve]\s?$/i ) { my $newentry=edit_entry(${$data->{$todo}->{entry}}); if ( $newentry eq ${$data->{$todo}->{entry}} ) { print "Not changed.\n"; |