Show netdisco-do docs on options error
This commit is contained in:
@@ -11,6 +11,7 @@
|
|||||||
* Reports config is now a list (see ReleaseNotes)
|
* Reports config is now a list (see ReleaseNotes)
|
||||||
* Add "AP" as a hint for WAP support
|
* Add "AP" as a hint for WAP support
|
||||||
* Attempt to keep PID and logfile as netdisco user even when running as root
|
* Attempt to keep PID and logfile as netdisco user even when running as root
|
||||||
|
* Show netdisco-do docs on options error
|
||||||
|
|
||||||
[BUG FIXES]
|
[BUG FIXES]
|
||||||
|
|
||||||
|
|||||||
@@ -41,6 +41,7 @@ use Dancer::Plugin::DBIC 'schema';
|
|||||||
info "App::Netdisco version $App::Netdisco::VERSION loaded.";
|
info "App::Netdisco version $App::Netdisco::VERSION loaded.";
|
||||||
|
|
||||||
use Try::Tiny;
|
use Try::Tiny;
|
||||||
|
use Pod::Usage;
|
||||||
use Getopt::Long;
|
use Getopt::Long;
|
||||||
Getopt::Long::Configure ("bundling");
|
Getopt::Long::Configure ("bundling");
|
||||||
|
|
||||||
@@ -50,7 +51,11 @@ my $result = GetOptions(
|
|||||||
'port|p=s' => \$port,
|
'port|p=s' => \$port,
|
||||||
'extra|e=s' => \$extra,
|
'extra|e=s' => \$extra,
|
||||||
'debug|D' => \$debug,
|
'debug|D' => \$debug,
|
||||||
) or exit(1);
|
) or pod2usage(
|
||||||
|
-msg => 'error: bad options',
|
||||||
|
-verbose => 0,
|
||||||
|
-exitval => 1,
|
||||||
|
);
|
||||||
|
|
||||||
my $CONFIG = config();
|
my $CONFIG = config();
|
||||||
$CONFIG->{logger} = 'console';
|
$CONFIG->{logger} = 'console';
|
||||||
@@ -66,8 +71,11 @@ schema('daemon')->deploy;
|
|||||||
my $action = shift @ARGV;
|
my $action = shift @ARGV;
|
||||||
|
|
||||||
unless ($action) {
|
unless ($action) {
|
||||||
error 'error: missing action!';
|
pod2usage(
|
||||||
exit (1);
|
-msg => 'error: missing action!',
|
||||||
|
-verbose => 2,
|
||||||
|
-exitval => 2,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
# create worker (placeholder object for the role methods)
|
# create worker (placeholder object for the role methods)
|
||||||
@@ -118,8 +126,11 @@ my $worker = MyWorker->new();
|
|||||||
|
|
||||||
# belt and braces check before we go ahead
|
# belt and braces check before we go ahead
|
||||||
if (not $worker->can( $action )) {
|
if (not $worker->can( $action )) {
|
||||||
error sprintf 'error: %s is not a valid action', $action;
|
pod2usage(
|
||||||
exit (1);
|
-msg => (sprintf 'error: %s is not a valid action', $action),
|
||||||
|
-verbose => 2,
|
||||||
|
-exitval => 3,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
# what job are we asked to do?
|
# what job are we asked to do?
|
||||||
@@ -151,7 +162,7 @@ exit ($status eq 'done' ? 0 : 1);
|
|||||||
|
|
||||||
netdisco-do - Run any Netdisco job from the command-line.
|
netdisco-do - Run any Netdisco job from the command-line.
|
||||||
|
|
||||||
=head1 USAGE
|
=head1 SYNOPSIS
|
||||||
|
|
||||||
~/bin/netdisco-do <action> [-D] [-d <device> [-p <port>] [-e <extra>]]
|
~/bin/netdisco-do <action> [-D] [-d <device> [-p <port>] [-e <extra>]]
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user