You've already forked pgbackrest
mirror of
https://github.com/pgbackrest/pgbackrest.git
synced 2025-07-01 00:25:06 +02:00
Error on multiple option alternate names and simplify help command.
There are currently no options with multiple alternate (deprecated) names so the code to render them in the help command could not be covered. Remove the uncovered code and add an error when multiple alternate names are configured. It's not clear that the current code was handling this correctly, so it will need to be reviewed if it comes up again.
This commit is contained in:
@ -337,6 +337,12 @@ sub process
|
||||
|
||||
if (@stryNameAlt > 0)
|
||||
{
|
||||
if (@stryNameAlt != 1)
|
||||
{
|
||||
confess &log(
|
||||
ERROR, "multiple alt names are not supported for option '${strOption}': " . join(', ', @stryNameAlt));
|
||||
}
|
||||
|
||||
$oCommandOption->{&CONFIG_HELP_NAME_ALT} = \@stryNameAlt;
|
||||
}
|
||||
}
|
||||
|
@ -163,6 +163,10 @@
|
||||
<p>Improve coverage in <file>perl/exec</file> module.</p>
|
||||
</release-item>
|
||||
|
||||
<release-item>
|
||||
<p>Error on multiple option alternate names and simplify help command.</p>
|
||||
</release-item>
|
||||
|
||||
<release-item>
|
||||
<p>Use <code>THROW_ON_SYS_ERROR*()</code> to improve code coverage.</p>
|
||||
</release-item>
|
||||
|
@ -356,26 +356,9 @@ helpRender(void)
|
||||
strCatFmt(result, "default: %s\n", strPtr(defaultValue));
|
||||
}
|
||||
|
||||
// Output alternate names (call them deprecated so the user will know not to use them)
|
||||
// Output alternate name (call it deprecated so the user will know not to use it)
|
||||
if (cfgDefOptionHelpNameAlt(optionDefId))
|
||||
{
|
||||
strCat(result, "\ndeprecated name");
|
||||
|
||||
if (cfgDefOptionHelpNameAltValueTotal(optionDefId) > 1) // {uncovered_branch - no option with more than one}
|
||||
strCat(result, "s"); // {+uncovered}
|
||||
|
||||
strCat(result, ": ");
|
||||
|
||||
for (unsigned int nameAltIdx = 0; nameAltIdx < cfgDefOptionHelpNameAltValueTotal(optionDefId); nameAltIdx++)
|
||||
{
|
||||
if (nameAltIdx != 0) // {uncovered_branch - no option with more than one}
|
||||
strCat(result, ", "); // {+uncovered}
|
||||
|
||||
strCat(result, cfgDefOptionHelpNameAltValue(optionDefId, nameAltIdx));
|
||||
}
|
||||
|
||||
strCat(result, "\n");
|
||||
}
|
||||
strCatFmt(result, "\ndeprecated name: %s\n", cfgDefOptionHelpNameAltValue(optionDefId, 0));
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user