From 574cd0bb9bc71a509b28394f8386d9caef3a7c25 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Sat, 7 Feb 2015 13:20:45 +0000 Subject: [PATCH] grep-excuses: --debug option For now this just shows the URL we fetch. Signed-off-by: Ian Jackson --- scripts/grep-excuses.1 | 3 +++ scripts/grep-excuses.pl | 9 +++++++++ 2 files changed, 12 insertions(+) diff --git a/scripts/grep-excuses.1 b/scripts/grep-excuses.1 index 4d603a5..bb115e3 100644 --- a/scripts/grep-excuses.1 +++ b/scripts/grep-excuses.1 @@ -25,6 +25,9 @@ Show a brief usage message. .TP .B \-\-version Show version and copyright information. +.TP +.B \-\-debug +Print debugging output to stderr (including url(s) fetched). .SH "CONFIGURATION VARIABLES" The two configuration files \fI/etc/devscripts.conf\fR and \fI~/.devscripts\fR are sourced in that order to set configuration diff --git a/scripts/grep-excuses.pl b/scripts/grep-excuses.pl index 67f0b6f..6a49935 100755 --- a/scripts/grep-excuses.pl +++ b/scripts/grep-excuses.pl @@ -24,6 +24,8 @@ use File::Basename; # Needed for --wipnity option +open DEBUG, ">/dev/null" or die $!; + my $term_size_broken; sub have_term_size { @@ -67,6 +69,7 @@ Options: name must be given when using this option. --help Show this help --version Give version information + --debug Print debugging output to stderr Default settings modified by devscripts configuration files: $modified_conf_msg @@ -150,6 +153,10 @@ while (@ARGV and $ARGV[0] =~ /^-/) { die "$progname: too many arguments! Try $progname --help for help.\n"; } else { wipnity($string); exit 0; } } + if ($ARGV[0] eq '--debug') { + open DEBUG, ">&STDERR" or die $!; + shift; next; + } if ($ARGV[0] eq '--help') { usage(); exit 0; } if ($ARGV[0] eq '--version') { print $version; exit 0; } if ($ARGV[0] =~ /^--no-?conf$/) { @@ -179,6 +186,8 @@ if (system("command -v wget >/dev/null 2>&1") != 0) { die "$progname: this program requires the wget package to be installed\n"; } +print DEBUG "Fetching $url\n"; + open EXCUSES, "wget -q -O - $url | zcat |" or die "$progname: wget | zcat failed: $!\n"; -- 2.30.2