Move --help
processing to %opt
This commit is contained in:
parent
c83dc67039
commit
9e659a18eb
1 changed files with 5 additions and 6 deletions
11
ddclient.in
11
ddclient.in
|
@ -1245,17 +1245,16 @@ my @opt = (
|
||||||
"",
|
"",
|
||||||
nic_examples(),
|
nic_examples(),
|
||||||
);
|
);
|
||||||
|
$opt{'help'} = sub {
|
||||||
|
print(usage(@opt), "\n");
|
||||||
|
$opt{'version'}('', '');
|
||||||
|
};
|
||||||
|
|
||||||
sub main {
|
sub main {
|
||||||
process_args(@opt);
|
process_args(@opt);
|
||||||
$saved_recap = '';
|
$saved_recap = '';
|
||||||
%saved_opt = %opt;
|
%saved_opt = %opt;
|
||||||
$result = 'OK';
|
$result = 'OK';
|
||||||
if (opt('help')) {
|
|
||||||
print(usage(@opt), "\n");
|
|
||||||
$opt{'version'}('', '');
|
|
||||||
}
|
|
||||||
|
|
||||||
## read config file because 'daemon' mode may be defined there.
|
## read config file because 'daemon' mode may be defined there.
|
||||||
read_config($opt{'file'} // default('file'), \%config, \%globals);
|
read_config($opt{'file'} // default('file'), \%config, \%globals);
|
||||||
init_config();
|
init_config();
|
||||||
|
@ -2126,7 +2125,7 @@ sub process_args {
|
||||||
$opt{$key} //= undef;
|
$opt{$key} //= undef;
|
||||||
}
|
}
|
||||||
if (!GetOptions(\%opt, @spec)) {
|
if (!GetOptions(\%opt, @spec)) {
|
||||||
$opt{"help"} = 1;
|
$opt{'help'}('', '');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue