1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-01-03 05:18:29 +03:00

help: show extents option for lvcreate

A special case is needed to display
--extents for lvcreate since the cmd defs
treat --extents as an automatic alternative
to --size (to avoid duplicating every cmd def).
This commit is contained in:
David Teigland 2017-03-02 16:33:14 -06:00
parent 9b23d9bfe4
commit 5d39927f22

View File

@ -1635,6 +1635,7 @@ void print_usage(struct command *cmd, int longhelp, int desc_first)
{ {
struct command_name *cname = find_command_name(cmd->name); struct command_name *cname = find_command_name(cmd->name);
int onereq = (cmd->cmd_flags & CMD_FLAG_ONE_REQUIRED_OPT) ? 1 : 0; int onereq = (cmd->cmd_flags & CMD_FLAG_ONE_REQUIRED_OPT) ? 1 : 0;
int include_extents = 0;
int ro, rp, oo, op, opt_enum, first; int ro, rp, oo, op, opt_enum, first;
/* /*
@ -1654,6 +1655,10 @@ void print_usage(struct command *cmd, int longhelp, int desc_first)
for (ro = 0; ro < cmd->ro_count; ro++) { for (ro = 0; ro < cmd->ro_count; ro++) {
opt_enum = cmd->required_opt_args[ro].opt; opt_enum = cmd->required_opt_args[ro].opt;
/* special case */
if (!strcmp(cmd->name, "lvcreate") && (opt_enum == size_ARG))
include_extents = 1;
if (onereq) { if (onereq) {
if (first) if (first)
printf("\n\t("); printf("\n\t(");
@ -1690,6 +1695,9 @@ void print_usage(struct command *cmd, int longhelp, int desc_first)
goto op_count; goto op_count;
if (cmd->oo_count) { if (cmd->oo_count) {
if (include_extents)
printf("\n\t[ --extents Number[PERCENT] ]");
for (oo = 0; oo < cmd->oo_count; oo++) { for (oo = 0; oo < cmd->oo_count; oo++) {
opt_enum = cmd->optional_opt_args[oo].opt; opt_enum = cmd->optional_opt_args[oo].opt;
@ -1822,8 +1830,9 @@ void print_usage_notes(struct command_name *cname, struct command *cmd)
if (!strcmp(cname->name, "lvcreate")) { if (!strcmp(cname->name, "lvcreate")) {
printf(" Special options for command:\n"); printf(" Special options for command:\n");
printf(" [ --extents NumberExtents ]\n" printf(" [ --extents Number[PERCENT] ]\n"
" The --extents option can be used in place of --size in each case.\n"); " The --extents option can be used in place of --size in each case.\n"
" The number allows an optional percent suffix (see man lvcreate).\n");
printf("\n"); printf("\n");
printf(" [ --name String ]\n" printf(" [ --name String ]\n"
" The --name option is not required but is typically used.\n" " The --name option is not required but is typically used.\n"