You've already forked pgbackrest
mirror of
https://github.com/pgbackrest/pgbackrest.git
synced 2026-05-22 10:15:16 +02:00
Fix help not displaying help for the help command.
'pgbackrest help help' just displayed the help overview, rather than display help for the help command. Fix this by making sure the command is set and routing correctly in the help command.
This commit is contained in:
@@ -289,7 +289,7 @@ helpRender(const Buffer *const helpData)
|
|||||||
const String *more = NULL;
|
const String *more = NULL;
|
||||||
|
|
||||||
// Display general help
|
// Display general help
|
||||||
if (cfgCommand() == cfgCmdHelp || cfgCommand() == cfgCmdNone)
|
if (cfgCommand() == cfgCmdNone)
|
||||||
{
|
{
|
||||||
strCatZ(
|
strCatZ(
|
||||||
result,
|
result,
|
||||||
|
|||||||
+4
-1
@@ -1766,8 +1766,11 @@ cfgParse(const Storage *const storage, const unsigned int argListSize, const cha
|
|||||||
if (!(parseRuleCommand[config->command].commandRoleValid & ((unsigned int)1 << config->commandRole)))
|
if (!(parseRuleCommand[config->command].commandRoleValid & ((unsigned int)1 << config->commandRole)))
|
||||||
THROW_FMT(CommandInvalidError, "invalid command/role combination '%s'", arg);
|
THROW_FMT(CommandInvalidError, "invalid command/role combination '%s'", arg);
|
||||||
|
|
||||||
if (config->command == cfgCmdHelp)
|
if (config->command == cfgCmdHelp && !config->help)
|
||||||
|
{
|
||||||
|
config->command = cfgCmdNone;
|
||||||
config->help = true;
|
config->help = true;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
commandSet = true;
|
commandSet = true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -886,6 +886,17 @@ testRun(void)
|
|||||||
TEST_RESULT_VOID(cfgLoad(strLstSize(argList), strLstPtr(argList)), "help command for backup");
|
TEST_RESULT_VOID(cfgLoad(strLstSize(argList), strLstPtr(argList)), "help command for backup");
|
||||||
TEST_RESULT_UINT(ioBufferSize(), 1048576, "buffer size set to option default");
|
TEST_RESULT_UINT(ioBufferSize(), 1048576, "buffer size set to option default");
|
||||||
|
|
||||||
|
// -------------------------------------------------------------------------------------------------------------------------
|
||||||
|
TEST_TITLE("help command for help");
|
||||||
|
|
||||||
|
argList = strLstNew();
|
||||||
|
strLstAddZ(argList, PROJECT_BIN);
|
||||||
|
strLstAddZ(argList, "help");
|
||||||
|
strLstAddZ(argList, "help");
|
||||||
|
|
||||||
|
TEST_RESULT_VOID(cfgLoad(strLstSize(argList), strLstPtr(argList)), "load config");
|
||||||
|
TEST_RESULT_UINT(ioBufferSize(), 1048576, "buffer size set to option default");
|
||||||
|
|
||||||
// -------------------------------------------------------------------------------------------------------------------------
|
// -------------------------------------------------------------------------------------------------------------------------
|
||||||
TEST_TITLE("command takes lock and opens log file and uses custom tcp settings");
|
TEST_TITLE("command takes lock and opens log file and uses custom tcp settings");
|
||||||
|
|
||||||
|
|||||||
@@ -1529,8 +1529,7 @@ testRun(void)
|
|||||||
|
|
||||||
TEST_RESULT_VOID(cfgParseP(storageTest, strLstSize(argList), strLstPtr(argList), .noResetLogLevel = true), "help command");
|
TEST_RESULT_VOID(cfgParseP(storageTest, strLstSize(argList), strLstPtr(argList), .noResetLogLevel = true), "help command");
|
||||||
TEST_RESULT_BOOL(cfgCommandHelp(), true, "help is set");
|
TEST_RESULT_BOOL(cfgCommandHelp(), true, "help is set");
|
||||||
TEST_RESULT_INT(cfgCommand(), cfgCmdHelp, "command is help");
|
TEST_RESULT_INT(cfgCommand(), cfgCmdNone, "command is help");
|
||||||
TEST_RESULT_Z(cfgCommandName(), "help", "command name is help");
|
|
||||||
|
|
||||||
argList = strLstNew();
|
argList = strLstNew();
|
||||||
strLstAddZ(argList, TEST_BACKREST_EXE);
|
strLstAddZ(argList, TEST_BACKREST_EXE);
|
||||||
@@ -1541,6 +1540,17 @@ testRun(void)
|
|||||||
cfgParseP(storageTest, strLstSize(argList), strLstPtr(argList), .noResetLogLevel = true), "help for version command");
|
cfgParseP(storageTest, strLstSize(argList), strLstPtr(argList), .noResetLogLevel = true), "help for version command");
|
||||||
TEST_RESULT_BOOL(cfgCommandHelp(), true, "help is set");
|
TEST_RESULT_BOOL(cfgCommandHelp(), true, "help is set");
|
||||||
TEST_RESULT_INT(cfgCommand(), cfgCmdVersion, "command is version");
|
TEST_RESULT_INT(cfgCommand(), cfgCmdVersion, "command is version");
|
||||||
|
TEST_RESULT_Z(cfgCommandName(), "version", "command name is version");
|
||||||
|
|
||||||
|
argList = strLstNew();
|
||||||
|
strLstAddZ(argList, TEST_BACKREST_EXE);
|
||||||
|
strLstAddZ(argList, "help");
|
||||||
|
strLstAddZ(argList, "help");
|
||||||
|
|
||||||
|
TEST_RESULT_VOID(
|
||||||
|
cfgParseP(storageTest, strLstSize(argList), strLstPtr(argList), .noResetLogLevel = true), "load config");
|
||||||
|
TEST_RESULT_BOOL(cfgCommandHelp(), true, "help is set");
|
||||||
|
TEST_RESULT_INT(cfgCommand(), cfgCmdHelp, "command is help");
|
||||||
|
|
||||||
// -------------------------------------------------------------------------------------------------------------------------
|
// -------------------------------------------------------------------------------------------------------------------------
|
||||||
TEST_TITLE("help option");
|
TEST_TITLE("help option");
|
||||||
|
|||||||
Reference in New Issue
Block a user