diff options
author | Raphael Geissert <geissert@debian.org> | 2014-03-08 16:03:09 +0000 |
---|---|---|
committer | Raphael Geissert <geissert@debian.org> | 2014-03-08 16:03:09 +0000 |
commit | 81bf578def4ed0d5dd881f8c0e892613952dcc81 (patch) | |
tree | 6bf4e2758c227a2a8d49401975e7ca4863c75ed0 /bin/check-new-issues | |
parent | cbb57806b4f674c242219eb08200d1971c1d7175 (diff) |
Add -s option to skip calls to apt-cache and apt-file
git-svn-id: svn+ssh://svn.debian.org/svn/secure-testing@26017 e39458fd-73e7-0310-bf30-c45bca0a0e42
Diffstat (limited to 'bin/check-new-issues')
-rwxr-xr-x | bin/check-new-issues | 64 |
1 files changed, 37 insertions, 27 deletions
diff --git a/bin/check-new-issues b/bin/check-new-issues index bef44e8d36..bec8485250 100755 --- a/bin/check-new-issues +++ b/bin/check-new-issues @@ -7,7 +7,7 @@ use Getopt::Std; use Term::ReadLine; my %opts; -getopts('ln:fhi:t:Tca:e:uU', \%opts); +getopts('ln:fhi:t:Tca:e:uUs', \%opts); sub print_commands { print <<'EOF'; @@ -52,6 +52,8 @@ OPTIONS: [ -l [-n <n>] [-f] ] -e <file> : use <file> for embedded-code-copies, "-" for STDIN -a <n> : If automatic apt-cache/apt-file search gives more than n results, display only the count (default 10) +-s : skip automatic apt-cache/apt-file searches, suggest the + command to run instead EOF @@ -364,15 +366,19 @@ sub auto_search { $prog = $1; } if ($prog) { - my $prog_esc =$prog; - $prog_esc =~ tr{a-zA-Z0-9_@/-}{ }cs; - print "doing apt-cache search..."; - my @ac=`apt-cache search $prog_esc`; - if (scalar @ac > $auto_display_limit || scalar @ac == 0) { - print "\r", scalar @ac, " results from apt-cache search $prog_esc\n"; - } - else { - print "\r=== apt-cache search $prog_esc:\n", @ac, "===\n"; + unless ($opts{s}) { + my $prog_esc =$prog; + $prog_esc =~ tr{a-zA-Z0-9_@/-}{ }cs; + print "doing apt-cache search..."; + my @ac=`apt-cache search $prog_esc`; + if (scalar @ac > $auto_display_limit || scalar @ac == 0) { + print "\r", scalar @ac, " results from apt-cache search $prog_esc\n"; + } + else { + print "\r=== apt-cache search $prog_esc:\n", @ac, "===\n"; + } + } else { + print "You probably want to .c$prog\n"; } foreach my $p (split /\s+/, $prog) { @@ -384,24 +390,28 @@ sub auto_search { return; } if ( $file =~ /(php3?|asp|cgi|pl)$/ ) { - if (! exists $afcache{$file}) { - my $file_esc = quotemeta($file); - print "doing apt-file search..."; - $afcache{$file}=[`apt-file -i search $file_esc`]; - if (scalar @{$afcache{$file}} > $auto_display_limit) { - # replace with empty array to save mem - my $num = scalar @{$afcache{$file}}; - $afcache{$file} = []; - $afcache{$file}->[$num-1] = undef; + unless ($opts{s}) { + if (! exists $afcache{$file}) { + my $file_esc = quotemeta($file); + print "doing apt-file search..."; + $afcache{$file}=[`apt-file -i search $file_esc`]; + if (scalar @{$afcache{$file}} > $auto_display_limit) { + # replace with empty array to save mem + my $num = scalar @{$afcache{$file}}; + $afcache{$file} = []; + $afcache{$file}->[$num-1] = undef; + } } - } - if (scalar @{$afcache{$file}} > $auto_display_limit || - scalar @{$afcache{$file}} == 0) { - print "\r", scalar @{$afcache{$file}}, - " results from apt-file -i search $file\n"; - } - else { - print "\r=== apt-file -i search $file:\n", @{$afcache{$file}}, "===\n"; + if (scalar @{$afcache{$file}} > $auto_display_limit || + scalar @{$afcache{$file}} == 0) { + print "\r", scalar @{$afcache{$file}}, + " results from apt-file -i search $file\n"; + } + else { + print "\r=== apt-file -i search $file:\n", @{$afcache{$file}}, "===\n"; + } + } else { + print "You probably want to .f$file\n"; } } } |