forked from rho_n/hpr_generator
Add quiet option to site-generator
Suppress progress information while generating pages.
This commit is contained in:
parent
4725547d39
commit
a194a28b71
@ -9,7 +9,8 @@
|
|||||||
site-generator [OPTION]... PAGE|PAGE=<comma separated list of ids>...
|
site-generator [OPTION]... PAGE|PAGE=<comma separated list of ids>...
|
||||||
|
|
||||||
-p, --preview print generated pages to standard out
|
-p, --preview print generated pages to standard out
|
||||||
-v, --verbose use verbose mode
|
-q, --quiet suppress progress information while generating pages
|
||||||
|
-v, --verbose print extended progress information while generating pages
|
||||||
--help print this help message
|
--help print this help message
|
||||||
|
|
||||||
Where I<PAGE> is a file name of a web page
|
Where I<PAGE> is a file name of a web page
|
||||||
@ -92,13 +93,19 @@ sub main {
|
|||||||
# Argument parsing
|
# Argument parsing
|
||||||
my $preview;
|
my $preview;
|
||||||
my $verbose;
|
my $verbose;
|
||||||
|
my $quiet;
|
||||||
GetOptions(
|
GetOptions(
|
||||||
'preview' => \$preview,
|
'preview' => \$preview,
|
||||||
'verbose' => \$verbose,
|
'verbose' => \$verbose,
|
||||||
|
'quiet' => \$quiet,
|
||||||
) or pod2usage(1);
|
) or pod2usage(1);
|
||||||
pod2usage(1) unless @ARGV;
|
pod2usage(1) unless @ARGV;
|
||||||
my (@page_args) = @ARGV;
|
my (@page_args) = @ARGV;
|
||||||
|
|
||||||
|
if ($quiet) {
|
||||||
|
$verbose = 'quiet';
|
||||||
|
};
|
||||||
|
|
||||||
# Set flag indicating whether or not to generate all pages.
|
# Set flag indicating whether or not to generate all pages.
|
||||||
# The flag is set to true if the special argument ALL is
|
# The flag is set to true if the special argument ALL is
|
||||||
# passed into the generator
|
# passed into the generator
|
||||||
@ -186,8 +193,10 @@ sub generate_page {
|
|||||||
sub verbose {
|
sub verbose {
|
||||||
my ($verbose, $message) = @_;
|
my ($verbose, $message) = @_;
|
||||||
if ($verbose) {
|
if ($verbose) {
|
||||||
|
if ($verbose ne 'quiet') {
|
||||||
print STDOUT "$message\n";
|
print STDOUT "$message\n";
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
STDOUT->autoflush(1);
|
STDOUT->autoflush(1);
|
||||||
print STDOUT ".";
|
print STDOUT ".";
|
||||||
|
Loading…
Reference in New Issue
Block a user