diff --git a/doc/man/dash-cli.1 b/doc/man/dash-cli.1 index dcc66efc43b03b..bc6f576198043e 100644 --- a/doc/man/dash-cli.1 +++ b/doc/man/dash-cli.1 @@ -16,7 +16,7 @@ dash\-cli [options] help Get help for a command .HP \-? .IP -This help message +Print this help message and exit .HP \fB\-conf=\fR .IP diff --git a/doc/man/dash-tx.1 b/doc/man/dash-tx.1 index ee37f4a043d0f3..84594e04976a75 100644 --- a/doc/man/dash-tx.1 +++ b/doc/man/dash-tx.1 @@ -15,7 +15,7 @@ Create hex\-encoded dash transaction .HP \-? .IP -This help message +Print this help message and exit .HP \fB\-create\fR .IP diff --git a/src/bench/bench_dash.cpp b/src/bench/bench_dash.cpp index 8fe2ddb0e2acf9..87e9c4847c04d8 100644 --- a/src/bench/bench_dash.cpp +++ b/src/bench/bench_dash.cpp @@ -34,16 +34,12 @@ static fs::path SetDataDir() } static void SetupBenchArgs() { - gArgs.AddArg("-?", "Print this help message and exit", false, OptionsCategory::OPTIONS); + SetupHelpOptions(gArgs); gArgs.AddArg("-list", "List benchmarks without executing them", false, OptionsCategory::OPTIONS); gArgs.AddArg("-filter=", strprintf("Regular expression filter to select benchmark by name (default: %s)", DEFAULT_BENCH_FILTER), false, OptionsCategory::OPTIONS); gArgs.AddArg("-asymptote=n1,n2,n3,...", strprintf("Test asymptotic growth of the runtime of an algorithm, if supported by the benchmark"), false, OptionsCategory::OPTIONS); gArgs.AddArg("-output_csv=", "Generate CSV file with the most important benchmark results.", false, OptionsCategory::OPTIONS); gArgs.AddArg("-output_json=", "Generate JSON file with all benchmark results.", false, OptionsCategory::OPTIONS); - - // Hidden - gArgs.AddArg("-h", "", false, OptionsCategory::HIDDEN); - gArgs.AddArg("-help", "", false, OptionsCategory::HIDDEN); } // parses a comma separated list like "10,20,30,50" diff --git a/src/dash-cli.cpp b/src/dash-cli.cpp index 4482287aa5997d..08825ae6975d6e 100644 --- a/src/dash-cli.cpp +++ b/src/dash-cli.cpp @@ -35,10 +35,11 @@ static const int CONTINUE_EXECUTION=-1; static void SetupCliArgs() { + SetupHelpOptions(gArgs); + const auto defaultBaseParams = CreateBaseChainParams(CBaseChainParams::MAIN); const auto testnetBaseParams = CreateBaseChainParams(CBaseChainParams::TESTNET); - gArgs.AddArg("-?", "This help message", false, OptionsCategory::OPTIONS); gArgs.AddArg("-version", "Print version and exit", false, OptionsCategory::OPTIONS); gArgs.AddArg("-conf=", strprintf("Specify configuration file. Relative paths will be prefixed by datadir location. (default: %s)", BITCOIN_CONF_FILENAME), false, OptionsCategory::OPTIONS); gArgs.AddArg("-datadir=", "Specify data directory", false, OptionsCategory::OPTIONS); @@ -54,12 +55,7 @@ static void SetupCliArgs() gArgs.AddArg("-rpcwallet=", "Send RPC for non-default wallet on RPC server (needs to exactly match corresponding -wallet option passed to dashd). This changes the RPC endpoint used, e.g. http://127.0.0.1:9998/wallet/", 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); - SetupChainParamsBaseOptions(); - - // Hidden - gArgs.AddArg("-h", "", false, OptionsCategory::HIDDEN); - gArgs.AddArg("-help", "", false, OptionsCategory::HIDDEN); } /** libevent event log callback */ diff --git a/src/dash-tx.cpp b/src/dash-tx.cpp index 335aa420dc63f2..509af0c692ff46 100644 --- a/src/dash-tx.cpp +++ b/src/dash-tx.cpp @@ -36,7 +36,8 @@ const std::function G_TRANSLATION_FUN = nullptr; 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("-json", "Select JSON output", false, OptionsCategory::OPTIONS); gArgs.AddArg("-txid", "Output only the hex-encoded transaction id of the resultant transaction.", false, OptionsCategory::OPTIONS); @@ -63,10 +64,6 @@ static void SetupBitcoinTxArgs() 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); - - // Hidden - gArgs.AddArg("-h", "", false, OptionsCategory::HIDDEN); - gArgs.AddArg("-help", "", false, OptionsCategory::HIDDEN); } // diff --git a/src/init.cpp b/src/init.cpp index 564cda513a0599..2e5c9b80608f46 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -468,20 +468,21 @@ std::string GetSupportedSocketEventsStr() 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 testnetBaseParams = CreateBaseChainParams(CBaseChainParams::TESTNET); const auto defaultChainParams = CreateChainParams(CBaseChainParams::MAIN); const auto testnetChainParams = CreateChainParams(CBaseChainParams::TESTNET); // Hidden Options - std::vector hidden_args = {"-h", "-help", "-dbcrashratio", "-forcecompactdb", "-printcrashinfo", + std::vector hidden_args = { + "-dbcrashratio", "-forcecompactdb", "-printcrashinfo", // GUI args. These will be overwritten by SetupUIArgs for the GUI "-allowselfsignedrootcertificates", "-choosedatadir", "-lang=", "-min", "-resetguisettings", "-rootcertificates=", "-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("-alertnotify=", "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=", 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("-blocksdir=", "Specify directory to hold blocks subdirectory for *.dat files (default: )", false, OptionsCategory::OPTIONS); @@ -681,7 +682,6 @@ void SetupServerArgs() "If is not supplied or if = 1, output all debugging information. can be: " + ListLogCategories() + ".", false, OptionsCategory::DEBUG_TEST); gArgs.AddArg("-debugexclude=", 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("-disablegovernance", strprintf("Disable governance validation (0-1, default: %u)", 0), 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("-logtimemicros", strprintf("Add microsecond precision to debug timestamps (default: %u)", DEFAULT_LOGTIMEMICROS), true, OptionsCategory::DEBUG_TEST); gArgs.AddArg("-logtimestamps", strprintf("Prepend debug output with timestamp (default: %u)", DEFAULT_LOGTIMESTAMPS), false, OptionsCategory::DEBUG_TEST); diff --git a/src/util/system.cpp b/src/util/system.cpp index 42f6cdc353d60a..774e9b0ffdb636 100644 --- a/src/util/system.cpp +++ b/src/util/system.cpp @@ -742,6 +742,12 @@ bool HelpRequested(const ArgsManager& args) 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 optIndent = 2; static const int msgIndent = 7; diff --git a/src/util/system.h b/src/util/system.h index 8289c164b33a59..31e6f8e90ecfdb 100644 --- a/src/util/system.h +++ b/src/util/system.h @@ -323,6 +323,9 @@ extern ArgsManager gArgs; */ 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 *