mirror of
https://github.com/pgbackrest/pgbackrest.git
synced 2024-12-14 10:13:05 +02:00
Fix rendering of key/value and list options in help.
Reported by Clinton Adams.
This commit is contained in:
parent
1a1ed8d6b9
commit
fd1984239e
@ -31,6 +31,14 @@
|
||||
|
||||
<p>Fix <br-option>archive-copy</br-option> throwing <quote>path not found</quote> error for incr/diff backups.</p>
|
||||
</release-item>
|
||||
|
||||
<release-item>
|
||||
<release-item-contributor-list>
|
||||
<release-item-ideator id="adams.clinton"/>
|
||||
</release-item-contributor-list>
|
||||
|
||||
<p>Fix rendering of key/value and list options in help.</p>
|
||||
</release-item>
|
||||
</release-bug-list>
|
||||
|
||||
<release-feature-list>
|
||||
|
@ -2,6 +2,7 @@
|
||||
Help Command
|
||||
***********************************************************************************************************************************/
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "common/io/handle.h"
|
||||
@ -73,6 +74,37 @@ helpRenderValue(const Variant *value)
|
||||
else
|
||||
result = strNew("n");
|
||||
}
|
||||
else if (varType(value) == varTypeKeyValue)
|
||||
{
|
||||
result = strNew("");
|
||||
|
||||
const KeyValue *optionKv = varKv(value);
|
||||
const VariantList *keyList = kvKeyList(optionKv);
|
||||
|
||||
for (uint keyIdx = 0; keyIdx < varLstSize(keyList); keyIdx++)
|
||||
{
|
||||
if (keyIdx != 0)
|
||||
strCat(result, ", ");
|
||||
|
||||
strCatFmt(
|
||||
result, "%s=%s", strPtr(varStr(varLstGet(keyList, keyIdx))),
|
||||
strPtr(varStrForce(kvGet(optionKv, varLstGet(keyList, keyIdx)))));
|
||||
}
|
||||
}
|
||||
else if (varType(value) == varTypeVariantList)
|
||||
{
|
||||
result = strNew("");
|
||||
|
||||
const VariantList *list = varVarLst(value);
|
||||
|
||||
for (uint listIdx = 0; listIdx < varLstSize(list); listIdx++)
|
||||
{
|
||||
if (listIdx != 0)
|
||||
strCat(result, ", ");
|
||||
|
||||
strCatFmt(result, "%s", strPtr(varStr(varLstGet(list, listIdx))));
|
||||
}
|
||||
}
|
||||
else
|
||||
result = varStrForce(value);
|
||||
}
|
||||
|
@ -106,10 +106,12 @@ testRun()
|
||||
"Command Options:\n"
|
||||
"\n"
|
||||
" --db-include restore only specified databases\n"
|
||||
" [current=db1, db2]\n"
|
||||
" --delta restore using delta [default=n]\n"
|
||||
" --force force a restore [default=n]\n"
|
||||
" --link-all restore all symlinks [default=n]\n"
|
||||
" --link-map modify the destination of a symlink\n"
|
||||
" [current=/link1=/dest1, /link2=/dest2]\n"
|
||||
" --recovery-option set an option in recovery.conf\n"
|
||||
" --set backup set to restore [default=latest]\n"
|
||||
" --tablespace-map restore a tablespace into the specified\n"
|
||||
@ -201,6 +203,10 @@ testRun()
|
||||
strLstAddZ(argList, "restore");
|
||||
strLstAddZ(argList, "--buffer-size=32768");
|
||||
strLstAddZ(argList, "--repo1-host=backup.example.net");
|
||||
strLstAddZ(argList, "--link-map=/link1=/dest1");
|
||||
strLstAddZ(argList, "--link-map=/link2=/dest2");
|
||||
strLstAddZ(argList, "--db-include=db1");
|
||||
strLstAddZ(argList, "--db-include=db2");
|
||||
TEST_RESULT_VOID(configParse(strLstSize(argList), strLstPtr(argList)), "help for restore command");
|
||||
TEST_RESULT_STR(strPtr(helpRender()), commandHelp, " check text");
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user