Make --help work either before or after subcommand

This commit is contained in:
Joe Cooper
2018-11-16 20:55:25 -06:00
parent 72ba5e3c51
commit 11bafbf540
3 changed files with 13 additions and 12 deletions

View File

@@ -44,7 +44,7 @@ sub main {
$user->{'twofactor_provider'} = undef;
$user->{'twofactor_id'} = undef;
$user->{'twofactor_apikey'} = undef;
acl::modify_user($user->{'name'}, $user);
acl::modify_user($user->{'name'}, $user);
reload_miniserv();
webmin_log("onefactor", "user", $user->{'name'});
@@ -111,12 +111,9 @@ Name of the user to disable two-factor authentication for.
=head1 EXIT CODES
0 on successfully replacing a config variable
0 on successfully replacing configuration options
1 on successfully adding a new config variable (the specified option did not
already exist in the file, and was added)
>1 on error
non-0 on error
=head1 LICENSE AND COPYRIGHT

View File

@@ -133,7 +133,7 @@ set-config
=head1 DESCRIPTION
Set a configuration directive in either miniserv.conf (the core Webmin config) or in the specified module config.
Set a configuration directive in either C<miniserv.conf> (the core Webmin config) or in the specified module C<config>.
=head1 SYNOPSIS

View File

@@ -34,7 +34,6 @@ sub main {
}
}
);
pod2usage(0) if ( $opt{'help'} );
$opt{'config'} ||= "/etc/webmin";
@@ -43,7 +42,7 @@ sub main {
if ($opt{'list'}) {
list_commands(\%opt);
exit 0;
} elsif ($opt{'man'}) {
} elsif ($opt{'man'} || $opt{'help'}) {
# Show the full manual page
man_command(\%opt, $subcmd);
exit 0;
@@ -165,6 +164,7 @@ sub list_commands {
}
}
# Display either a short usage message (--help) or a full manual (--man)
sub man_command {
my ($optref, $subcmd) = @_;
@@ -173,9 +173,13 @@ sub man_command {
$ENV{'PAGER'} ||= "more";
open(my $PAGER, "|-", "$ENV{'PAGER'}");
pod2usage( -verbose => 99,
-input => $command_path,
-output => $PAGER);
if ($optref->{'help'}) {
pod2usage( -input => $command_path );
} else {
pod2usage( -verbose => 99,
-input => $command_path,
-output => $PAGER);
}
}
sub root {