util: Add SetupHelpOptions()
This commit is contained in:
parent
1a6036978e
commit
a99999cc04
10 changed files with 23 additions and 28 deletions
|
@ -20,7 +20,7 @@ Bitcoin Core RPC client version v0.17.99.0
|
||||||
.HP
|
.HP
|
||||||
\-?
|
\-?
|
||||||
.IP
|
.IP
|
||||||
This help message
|
Print this help message and exit
|
||||||
.HP
|
.HP
|
||||||
\fB\-conf=\fR<file>
|
\fB\-conf=\fR<file>
|
||||||
.IP
|
.IP
|
||||||
|
|
|
@ -14,7 +14,7 @@ Bitcoin Core bitcoin\-tx utility version v0.17.99.0
|
||||||
.HP
|
.HP
|
||||||
\-?
|
\-?
|
||||||
.IP
|
.IP
|
||||||
This help message
|
Print this help message and exit
|
||||||
.HP
|
.HP
|
||||||
\fB\-create\fR
|
\fB\-create\fR
|
||||||
.IP
|
.IP
|
||||||
|
|
|
@ -15,7 +15,7 @@ bitcoin\-wallet [options] <command>
|
||||||
.HP
|
.HP
|
||||||
\-?
|
\-?
|
||||||
.IP
|
.IP
|
||||||
This help message
|
Print this help message and exit
|
||||||
.HP
|
.HP
|
||||||
\fB\-datadir=\fR<dir>
|
\fB\-datadir=\fR<dir>
|
||||||
.IP
|
.IP
|
||||||
|
|
|
@ -24,7 +24,8 @@ static const int64_t DEFAULT_PLOT_HEIGHT = 768;
|
||||||
|
|
||||||
static void SetupBenchArgs()
|
static void SetupBenchArgs()
|
||||||
{
|
{
|
||||||
gArgs.AddArg("-?", "Print this help message and exit", false, OptionsCategory::OPTIONS);
|
SetupHelpOptions(gArgs);
|
||||||
|
|
||||||
gArgs.AddArg("-list", "List benchmarks without executing them. Can be combined with -scaling and -filter", false, OptionsCategory::OPTIONS);
|
gArgs.AddArg("-list", "List benchmarks without executing them. Can be combined with -scaling and -filter", false, OptionsCategory::OPTIONS);
|
||||||
gArgs.AddArg("-evals=<n>", strprintf("Number of measurement evaluations to perform. (default: %u)", DEFAULT_BENCH_EVALUATIONS), false, OptionsCategory::OPTIONS);
|
gArgs.AddArg("-evals=<n>", strprintf("Number of measurement evaluations to perform. (default: %u)", DEFAULT_BENCH_EVALUATIONS), false, OptionsCategory::OPTIONS);
|
||||||
gArgs.AddArg("-filter=<regex>", strprintf("Regular expression filter to select benchmark by name (default: %s)", DEFAULT_BENCH_FILTER), false, OptionsCategory::OPTIONS);
|
gArgs.AddArg("-filter=<regex>", strprintf("Regular expression filter to select benchmark by name (default: %s)", DEFAULT_BENCH_FILTER), false, OptionsCategory::OPTIONS);
|
||||||
|
@ -33,10 +34,6 @@ static void SetupBenchArgs()
|
||||||
gArgs.AddArg("-plot-plotlyurl=<uri>", strprintf("URL to use for plotly.js (default: %s)", DEFAULT_PLOT_PLOTLYURL), false, OptionsCategory::OPTIONS);
|
gArgs.AddArg("-plot-plotlyurl=<uri>", strprintf("URL to use for plotly.js (default: %s)", DEFAULT_PLOT_PLOTLYURL), false, OptionsCategory::OPTIONS);
|
||||||
gArgs.AddArg("-plot-width=<x>", strprintf("Plot width in pixel (default: %u)", DEFAULT_PLOT_WIDTH), false, OptionsCategory::OPTIONS);
|
gArgs.AddArg("-plot-width=<x>", strprintf("Plot width in pixel (default: %u)", DEFAULT_PLOT_WIDTH), false, OptionsCategory::OPTIONS);
|
||||||
gArgs.AddArg("-plot-height=<x>", strprintf("Plot height in pixel (default: %u)", DEFAULT_PLOT_HEIGHT), false, OptionsCategory::OPTIONS);
|
gArgs.AddArg("-plot-height=<x>", strprintf("Plot height in pixel (default: %u)", DEFAULT_PLOT_HEIGHT), false, OptionsCategory::OPTIONS);
|
||||||
|
|
||||||
// Hidden
|
|
||||||
gArgs.AddArg("-h", "", false, OptionsCategory::HIDDEN);
|
|
||||||
gArgs.AddArg("-help", "", false, OptionsCategory::HIDDEN);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static fs::path SetDataDir()
|
static fs::path SetDataDir()
|
||||||
|
|
|
@ -34,11 +34,12 @@ static const int CONTINUE_EXECUTION=-1;
|
||||||
|
|
||||||
static void SetupCliArgs()
|
static void SetupCliArgs()
|
||||||
{
|
{
|
||||||
|
SetupHelpOptions(gArgs);
|
||||||
|
|
||||||
const auto defaultBaseParams = CreateBaseChainParams(CBaseChainParams::MAIN);
|
const auto defaultBaseParams = CreateBaseChainParams(CBaseChainParams::MAIN);
|
||||||
const auto testnetBaseParams = CreateBaseChainParams(CBaseChainParams::TESTNET);
|
const auto testnetBaseParams = CreateBaseChainParams(CBaseChainParams::TESTNET);
|
||||||
const auto regtestBaseParams = CreateBaseChainParams(CBaseChainParams::REGTEST);
|
const auto regtestBaseParams = CreateBaseChainParams(CBaseChainParams::REGTEST);
|
||||||
|
|
||||||
gArgs.AddArg("-?", "This help message", false, OptionsCategory::OPTIONS);
|
|
||||||
gArgs.AddArg("-version", "Print version and exit", false, OptionsCategory::OPTIONS);
|
gArgs.AddArg("-version", "Print version and exit", false, OptionsCategory::OPTIONS);
|
||||||
gArgs.AddArg("-conf=<file>", strprintf("Specify configuration file. Relative paths will be prefixed by datadir location. (default: %s)", BITCOIN_CONF_FILENAME), false, OptionsCategory::OPTIONS);
|
gArgs.AddArg("-conf=<file>", strprintf("Specify configuration file. Relative paths will be prefixed by datadir location. (default: %s)", BITCOIN_CONF_FILENAME), false, OptionsCategory::OPTIONS);
|
||||||
gArgs.AddArg("-datadir=<dir>", "Specify data directory", false, OptionsCategory::OPTIONS);
|
gArgs.AddArg("-datadir=<dir>", "Specify data directory", false, OptionsCategory::OPTIONS);
|
||||||
|
@ -55,10 +56,6 @@ static void SetupCliArgs()
|
||||||
gArgs.AddArg("-rpcwallet=<walletname>", "Send RPC for non-default wallet on RPC server (needs to exactly match corresponding -wallet option passed to bitcoind). This changes the RPC endpoint used, e.g. http://127.0.0.1:8332/wallet/<walletname>", false, OptionsCategory::OPTIONS);
|
gArgs.AddArg("-rpcwallet=<walletname>", "Send RPC for non-default wallet on RPC server (needs to exactly match corresponding -wallet option passed to bitcoind). This changes the RPC endpoint used, e.g. http://127.0.0.1:8332/wallet/<walletname>", false, OptionsCategory::OPTIONS);
|
||||||
gArgs.AddArg("-stdin", "Read extra arguments from standard input, one per line until EOF/Ctrl-D (recommended for sensitive information such as passphrases). When combined with -stdinrpcpass, the first line from standard input is used for the RPC password.", false, OptionsCategory::OPTIONS);
|
gArgs.AddArg("-stdin", "Read extra arguments from standard input, one per line until EOF/Ctrl-D (recommended for sensitive information such as passphrases). When combined with -stdinrpcpass, the first line from standard input is used for the RPC password.", false, OptionsCategory::OPTIONS);
|
||||||
gArgs.AddArg("-stdinrpcpass", "Read RPC password from standard input as a single line. When combined with -stdin, the first line from standard input is used for the RPC password.", false, OptionsCategory::OPTIONS);
|
gArgs.AddArg("-stdinrpcpass", "Read RPC password from standard input as a single line. When combined with -stdin, the first line from standard input is used for the RPC password.", false, OptionsCategory::OPTIONS);
|
||||||
|
|
||||||
// Hidden
|
|
||||||
gArgs.AddArg("-h", "", false, OptionsCategory::HIDDEN);
|
|
||||||
gArgs.AddArg("-help", "", false, OptionsCategory::HIDDEN);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** libevent event log callback */
|
/** libevent event log callback */
|
||||||
|
|
|
@ -35,7 +35,8 @@ const std::function<std::string(const char*)> G_TRANSLATION_FUN = nullptr;
|
||||||
|
|
||||||
static void SetupBitcoinTxArgs()
|
static void SetupBitcoinTxArgs()
|
||||||
{
|
{
|
||||||
gArgs.AddArg("-?", "This help message", false, OptionsCategory::OPTIONS);
|
SetupHelpOptions(gArgs);
|
||||||
|
|
||||||
gArgs.AddArg("-create", "Create new, empty TX.", false, OptionsCategory::OPTIONS);
|
gArgs.AddArg("-create", "Create new, empty TX.", false, OptionsCategory::OPTIONS);
|
||||||
gArgs.AddArg("-json", "Select JSON output", false, OptionsCategory::OPTIONS);
|
gArgs.AddArg("-json", "Select JSON output", false, OptionsCategory::OPTIONS);
|
||||||
gArgs.AddArg("-txid", "Output only the hex-encoded transaction id of the resultant transaction.", false, OptionsCategory::OPTIONS);
|
gArgs.AddArg("-txid", "Output only the hex-encoded transaction id of the resultant transaction.", false, OptionsCategory::OPTIONS);
|
||||||
|
@ -66,10 +67,6 @@ static void SetupBitcoinTxArgs()
|
||||||
|
|
||||||
gArgs.AddArg("load=NAME:FILENAME", "Load JSON file FILENAME into register NAME", false, OptionsCategory::REGISTER_COMMANDS);
|
gArgs.AddArg("load=NAME:FILENAME", "Load JSON file FILENAME into register NAME", false, OptionsCategory::REGISTER_COMMANDS);
|
||||||
gArgs.AddArg("set=NAME:JSON-STRING", "Set register NAME to given JSON-STRING", false, OptionsCategory::REGISTER_COMMANDS);
|
gArgs.AddArg("set=NAME:JSON-STRING", "Set register NAME to given JSON-STRING", false, OptionsCategory::REGISTER_COMMANDS);
|
||||||
|
|
||||||
// Hidden
|
|
||||||
gArgs.AddArg("-h", "", false, OptionsCategory::HIDDEN);
|
|
||||||
gArgs.AddArg("-help", "", false, OptionsCategory::HIDDEN);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
|
@ -20,9 +20,9 @@ const std::function<std::string(const char*)> G_TRANSLATION_FUN = nullptr;
|
||||||
|
|
||||||
static void SetupWalletToolArgs()
|
static void SetupWalletToolArgs()
|
||||||
{
|
{
|
||||||
|
SetupHelpOptions(gArgs);
|
||||||
SetupChainParamsBaseOptions();
|
SetupChainParamsBaseOptions();
|
||||||
|
|
||||||
gArgs.AddArg("-?", "This help message", false, OptionsCategory::OPTIONS);
|
|
||||||
gArgs.AddArg("-datadir=<dir>", "Specify data directory", false, OptionsCategory::OPTIONS);
|
gArgs.AddArg("-datadir=<dir>", "Specify data directory", false, OptionsCategory::OPTIONS);
|
||||||
gArgs.AddArg("-wallet=<wallet-name>", "Specify wallet name", false, OptionsCategory::OPTIONS);
|
gArgs.AddArg("-wallet=<wallet-name>", "Specify wallet name", false, OptionsCategory::OPTIONS);
|
||||||
gArgs.AddArg("-debug=<category>", "Output debugging information (default: 0).", false, OptionsCategory::DEBUG_TEST);
|
gArgs.AddArg("-debug=<category>", "Output debugging information (default: 0).", false, OptionsCategory::DEBUG_TEST);
|
||||||
|
@ -30,10 +30,6 @@ static void SetupWalletToolArgs()
|
||||||
|
|
||||||
gArgs.AddArg("info", "Get wallet info", false, OptionsCategory::COMMANDS);
|
gArgs.AddArg("info", "Get wallet info", false, OptionsCategory::COMMANDS);
|
||||||
gArgs.AddArg("create", "Create new wallet file", false, OptionsCategory::COMMANDS);
|
gArgs.AddArg("create", "Create new wallet file", false, OptionsCategory::COMMANDS);
|
||||||
|
|
||||||
// Hidden
|
|
||||||
gArgs.AddArg("-h", "", false, OptionsCategory::HIDDEN);
|
|
||||||
gArgs.AddArg("-help", "", false, OptionsCategory::HIDDEN);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool WalletAppInit(int argc, char* argv[])
|
static bool WalletAppInit(int argc, char* argv[])
|
||||||
|
|
|
@ -326,6 +326,9 @@ static void OnRPCStopped()
|
||||||
|
|
||||||
void SetupServerArgs()
|
void SetupServerArgs()
|
||||||
{
|
{
|
||||||
|
SetupHelpOptions(gArgs);
|
||||||
|
gArgs.AddArg("-help-debug", "Print help message with debugging options and exit", false, OptionsCategory::DEBUG_TEST); // server-only for now
|
||||||
|
|
||||||
const auto defaultBaseParams = CreateBaseChainParams(CBaseChainParams::MAIN);
|
const auto defaultBaseParams = CreateBaseChainParams(CBaseChainParams::MAIN);
|
||||||
const auto testnetBaseParams = CreateBaseChainParams(CBaseChainParams::TESTNET);
|
const auto testnetBaseParams = CreateBaseChainParams(CBaseChainParams::TESTNET);
|
||||||
const auto regtestBaseParams = CreateBaseChainParams(CBaseChainParams::REGTEST);
|
const auto regtestBaseParams = CreateBaseChainParams(CBaseChainParams::REGTEST);
|
||||||
|
@ -334,14 +337,11 @@ void SetupServerArgs()
|
||||||
const auto regtestChainParams = CreateChainParams(CBaseChainParams::REGTEST);
|
const auto regtestChainParams = CreateChainParams(CBaseChainParams::REGTEST);
|
||||||
|
|
||||||
// Hidden Options
|
// Hidden Options
|
||||||
std::vector<std::string> hidden_args = {"-h", "-help",
|
std::vector<std::string> hidden_args = {
|
||||||
"-dbcrashratio", "-forcecompactdb",
|
"-dbcrashratio", "-forcecompactdb",
|
||||||
// GUI args. These will be overwritten by SetupUIArgs for the GUI
|
// GUI args. These will be overwritten by SetupUIArgs for the GUI
|
||||||
"-allowselfsignedrootcertificates", "-choosedatadir", "-lang=<lang>", "-min", "-resetguisettings", "-rootcertificates=<file>", "-splash", "-uiplatform"};
|
"-allowselfsignedrootcertificates", "-choosedatadir", "-lang=<lang>", "-min", "-resetguisettings", "-rootcertificates=<file>", "-splash", "-uiplatform"};
|
||||||
|
|
||||||
// Set all of the args and their help
|
|
||||||
// When adding new options to the categories, please keep and ensure alphabetical ordering.
|
|
||||||
gArgs.AddArg("-?", "Print this help message and exit", false, OptionsCategory::OPTIONS);
|
|
||||||
gArgs.AddArg("-version", "Print version and exit", false, OptionsCategory::OPTIONS);
|
gArgs.AddArg("-version", "Print version and exit", false, OptionsCategory::OPTIONS);
|
||||||
gArgs.AddArg("-alertnotify=<cmd>", "Execute command when a relevant alert is received or we see a really long fork (%s in cmd is replaced by message)", false, OptionsCategory::OPTIONS);
|
gArgs.AddArg("-alertnotify=<cmd>", "Execute command when a relevant alert is received or we see a really long fork (%s in cmd is replaced by message)", false, OptionsCategory::OPTIONS);
|
||||||
gArgs.AddArg("-assumevalid=<hex>", strprintf("If this block is in the chain assume that it and its ancestors are valid and potentially skip their script verification (0 to verify all, default: %s, testnet: %s)", defaultChainParams->GetConsensus().defaultAssumeValid.GetHex(), testnetChainParams->GetConsensus().defaultAssumeValid.GetHex()), false, OptionsCategory::OPTIONS);
|
gArgs.AddArg("-assumevalid=<hex>", strprintf("If this block is in the chain assume that it and its ancestors are valid and potentially skip their script verification (0 to verify all, default: %s, testnet: %s)", defaultChainParams->GetConsensus().defaultAssumeValid.GetHex(), testnetChainParams->GetConsensus().defaultAssumeValid.GetHex()), false, OptionsCategory::OPTIONS);
|
||||||
|
@ -470,7 +470,6 @@ void SetupServerArgs()
|
||||||
gArgs.AddArg("-debug=<category>", "Output debugging information (default: -nodebug, supplying <category> is optional). "
|
gArgs.AddArg("-debug=<category>", "Output debugging information (default: -nodebug, supplying <category> is optional). "
|
||||||
"If <category> is not supplied or if <category> = 1, output all debugging information. <category> can be: " + ListLogCategories() + ".", false, OptionsCategory::DEBUG_TEST);
|
"If <category> is not supplied or if <category> = 1, output all debugging information. <category> can be: " + ListLogCategories() + ".", false, OptionsCategory::DEBUG_TEST);
|
||||||
gArgs.AddArg("-debugexclude=<category>", strprintf("Exclude debugging information for a category. Can be used in conjunction with -debug=1 to output debug logs for all categories except one or more specified categories."), false, OptionsCategory::DEBUG_TEST);
|
gArgs.AddArg("-debugexclude=<category>", strprintf("Exclude debugging information for a category. Can be used in conjunction with -debug=1 to output debug logs for all categories except one or more specified categories."), false, OptionsCategory::DEBUG_TEST);
|
||||||
gArgs.AddArg("-help-debug", "Print help message with debugging options and exit", false, OptionsCategory::DEBUG_TEST);
|
|
||||||
gArgs.AddArg("-logips", strprintf("Include IP addresses in debug output (default: %u)", DEFAULT_LOGIPS), false, OptionsCategory::DEBUG_TEST);
|
gArgs.AddArg("-logips", strprintf("Include IP addresses in debug output (default: %u)", DEFAULT_LOGIPS), false, OptionsCategory::DEBUG_TEST);
|
||||||
gArgs.AddArg("-logtimestamps", strprintf("Prepend debug output with timestamp (default: %u)", DEFAULT_LOGTIMESTAMPS), false, OptionsCategory::DEBUG_TEST);
|
gArgs.AddArg("-logtimestamps", strprintf("Prepend debug output with timestamp (default: %u)", DEFAULT_LOGTIMESTAMPS), false, OptionsCategory::DEBUG_TEST);
|
||||||
gArgs.AddArg("-logtimemicros", strprintf("Add microsecond precision to debug timestamps (default: %u)", DEFAULT_LOGTIMEMICROS), true, OptionsCategory::DEBUG_TEST);
|
gArgs.AddArg("-logtimemicros", strprintf("Add microsecond precision to debug timestamps (default: %u)", DEFAULT_LOGTIMEMICROS), true, OptionsCategory::DEBUG_TEST);
|
||||||
|
|
|
@ -635,6 +635,12 @@ bool HelpRequested(const ArgsManager& args)
|
||||||
return args.IsArgSet("-?") || args.IsArgSet("-h") || args.IsArgSet("-help") || args.IsArgSet("-help-debug");
|
return args.IsArgSet("-?") || args.IsArgSet("-h") || args.IsArgSet("-help") || args.IsArgSet("-help-debug");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SetupHelpOptions(ArgsManager& args)
|
||||||
|
{
|
||||||
|
args.AddArg("-?", "Print this help message and exit", false, OptionsCategory::OPTIONS);
|
||||||
|
args.AddHiddenArgs({"-h", "-help"});
|
||||||
|
}
|
||||||
|
|
||||||
static const int screenWidth = 79;
|
static const int screenWidth = 79;
|
||||||
static const int optIndent = 2;
|
static const int optIndent = 2;
|
||||||
static const int msgIndent = 7;
|
static const int msgIndent = 7;
|
||||||
|
|
|
@ -295,6 +295,9 @@ extern ArgsManager gArgs;
|
||||||
*/
|
*/
|
||||||
bool HelpRequested(const ArgsManager& args);
|
bool HelpRequested(const ArgsManager& args);
|
||||||
|
|
||||||
|
/** Add help options to the args manager */
|
||||||
|
void SetupHelpOptions(ArgsManager& args);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Format a string to be used as group of options in help messages
|
* Format a string to be used as group of options in help messages
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in a new issue