Start setting up the options in a standard way

This commit is contained in:
Duncan Ferguson 2014-06-07 22:53:42 +01:00
parent be4093f728
commit 8569cdaca5

View file

@ -97,20 +97,13 @@ sub new {
$self->loc("Enable debugging. Either a level can be provided or the option can be repeated multiple times. Maximum level is 4."),
default => 0,
},
'help|h' =>
{ help => $self->loc("Show help text and exit"), },
'usage|?' =>
{ help => $self->loc('Show basic usage and exit'), },
'version|v' =>
{ help => $self->loc("Show version information and exit"), },
'man|H' => {
help => $self->loc("Show full help text (the man page) and exit"),
},
'generate-pod' => {
hidden => 1,
},
};
$self->add_common_options;
return $self;
}
@ -124,6 +117,23 @@ sub add_option {
sub add_common_options {
my ( $self ) = @_;
$self->add_option(
spec => 'help|h' ,
help => $self->loc("Show help text and exit"),
);
$self->add_option(
spec => 'usage|?' ,
help => $self->loc('Show basic usage and exit'),
);
$self->add_option(
spec => 'version|v' ,
help => $self->loc("Show version information and exit"),
);
$self->add_option(
spec => 'man|H' ,
help => $self->loc("Show full help text (the man page) and exit"),
);
return $self;
}