1
0
mirror of https://github.com/pgbackrest/pgbackrest.git synced 2025-10-30 23:37:45 +02:00

Show index in examples for indexed options, i.e. repo-*, pg-*.

Suggested by Stephen Frost.
This commit is contained in:
David Steele
2018-03-06 14:20:12 -05:00
parent 45ffe37e4f
commit 4c8ed3530c
2 changed files with 15 additions and 3 deletions

View File

@@ -838,6 +838,10 @@ sub helpOptionGet
# Get the example
my $strExample;
my $strOptionPrefix = $rhConfigDefine->{$strOption}{&CFGDEF_PREFIX};
my $strOptionIndex = defined($strOptionPrefix) ?
"${strOptionPrefix}1-" . substr($strOption, length($strOptionPrefix) + 1) : $strOption;
if (defined($strCommand))
{
if (docConfigOptionTypeTest($strOption, CFGDEF_TYPE_BOOLEAN))
@@ -848,16 +852,16 @@ sub helpOptionGet
$$oOptionHash{&CONFIG_HELP_EXAMPLE});
}
$strExample = '--' . ($$oOptionHash{&CONFIG_HELP_EXAMPLE} eq 'n' ? 'no-' : '') . $strOption;
$strExample = '--' . ($$oOptionHash{&CONFIG_HELP_EXAMPLE} eq 'n' ? 'no-' : '') . $strOptionIndex;
}
else
{
$strExample = "--${strOption}=" . $$oOptionHash{&CONFIG_HELP_EXAMPLE};
$strExample = "--${strOptionIndex}=" . $$oOptionHash{&CONFIG_HELP_EXAMPLE};
}
}
else
{
$strExample = "${strOption}=" . $$oOptionHash{&CONFIG_HELP_EXAMPLE};
$strExample = "${strOptionIndex}=" . $$oOptionHash{&CONFIG_HELP_EXAMPLE};
}
$strCodeBlock .= (defined($strCodeBlock) ? "\n" : '') . "example: ${strExample}";