You've already forked pgbackrest
mirror of
https://github.com/pgbackrest/pgbackrest.git
synced 2025-11-08 03:22:25 +03:00
Fix rendering of key/value and list options in help.
Reported by Clinton Adams.
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user