mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-21 13:34:40 +03:00
commands: avoid factoring options until needed
This commit is contained in:
parent
22bee4fbdb
commit
15f51bc421
@ -1197,6 +1197,10 @@ static void factor_common_options(void)
|
||||
if (!command_names[cn].name)
|
||||
break;
|
||||
|
||||
/* already factored */
|
||||
if (command_names[cn].variants)
|
||||
continue;
|
||||
|
||||
for (ci = 0; ci < COMMAND_COUNT; ci++) {
|
||||
cmd = &commands[ci];
|
||||
|
||||
@ -1455,19 +1459,12 @@ int define_commands(char *run_name)
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* For usage.
|
||||
* Looks at all variants of each command name and figures out
|
||||
* which options are common to all variants (for compact output)
|
||||
*/
|
||||
factor_common_options();
|
||||
|
||||
/*
|
||||
* For usage.
|
||||
* Predefined string of options common to all commands
|
||||
* (for compact output)
|
||||
*/
|
||||
include_optional_opt_args(&lvm_all, "OO_USAGE_COMMON");
|
||||
include_optional_opt_args(&lvm_all, "OO_USAGE_COMMON");
|
||||
|
||||
return 1;
|
||||
}
|
||||
@ -1564,6 +1561,12 @@ void print_usage(struct command *cmd)
|
||||
int onereq = (cmd->cmd_flags & CMD_FLAG_ONE_REQUIRED_OPT) ? 1 : 0;
|
||||
int ro, rp, oo, op, opt_enum, first;
|
||||
|
||||
/*
|
||||
* Looks at all variants of each command name and figures out
|
||||
* which options are common to all variants (for compact output)
|
||||
*/
|
||||
factor_common_options();
|
||||
|
||||
if (cmd->desc)
|
||||
_print_usage_description(cmd);
|
||||
|
||||
@ -2717,6 +2720,8 @@ int main(int argc, char *argv[])
|
||||
|
||||
define_commands(NULL);
|
||||
|
||||
factor_common_options();
|
||||
|
||||
print_man(argv[1], (argc > 2) ? argv[2] : NULL, 1, 1);
|
||||
|
||||
return 0;
|
||||
|
Loading…
Reference in New Issue
Block a user