#include <common/args.h>
#include <chainparamsbase.h>
#include <common/settings.h>
#include <sync.h>
#include <tinyformat.h>
#include <univalue.h>
#include <util/chaintype.h>
#include <util/check.h>
#include <util/fs.h>
#include <util/fs_helpers.h>
#include <util/log.h>
#include <util/strencodings.h>
#include <util/string.h>
#include <algorithm>
#include <cstdlib>
#include <cstring>
#include <map>
#include <optional>
#include <stdexcept>
#include <string>
#include <utility>
#include <variant>
Go to the source code of this file.
|
| static bool | InterpretBool (const std::string &strValue) |
| | Interpret a string argument as a boolean.
|
| |
| static std::string | SettingName (const std::string &arg) |
| |
| KeyInfo | InterpretKey (std::string key) |
| | Parse "name", "section.name", "noname", "section.noname" settings keys.
|
| |
| std::optional< common::SettingsValue > | InterpretValue (const KeyInfo &key, const std::string *value, unsigned int flags, std::string &error) |
| | Interpret settings value based on registered flags.
|
| |
| static void | SaveErrors (const std::vector< std::string > errors, std::vector< std::string > *error_out) |
| |
| std::optional< std::string > | SettingToString (const common::SettingsValue &value) |
| |
| template<std::integral Int> |
| std::optional< Int > | SettingTo (const common::SettingsValue &value) |
| |
| std::optional< bool > | SettingToBool (const common::SettingsValue &value) |
| |
| | INSTANTIATE_INT_TYPE (int8_t) |
| |
| | INSTANTIATE_INT_TYPE (uint8_t) |
| |
| | INSTANTIATE_INT_TYPE (int16_t) |
| |
| | INSTANTIATE_INT_TYPE (uint16_t) |
| |
| | INSTANTIATE_INT_TYPE (int32_t) |
| |
| | INSTANTIATE_INT_TYPE (uint32_t) |
| |
| | INSTANTIATE_INT_TYPE (int64_t) |
| |
| | INSTANTIATE_INT_TYPE (uint64_t) |
| |
| bool | HelpRequested (const ArgsManager &args) |
| |
| void | SetupHelpOptions (ArgsManager &args) |
| | Add help options to the args manager.
|
| |
| std::string | HelpMessageGroup (const std::string &message) |
| | Format a string to be used as group of options in help messages.
|
| |
| std::string | HelpMessageOpt (std::string_view option, std::string_view help_param, std::string_view message, bool subopt) |
| | Format a string to be used as option description in help messages.
|
| |
| bool | HasTestOption (const ArgsManager &args, const std::string &test_option) |
| | Checks if a particular test option is present in -test command-line arg options.
|
| |
| fs::path | GetDefaultDataDir () |
| |
| bool | CheckDataDirOption (const ArgsManager &args) |
| |
◆ INSTANTIATE_INT_TYPE
| #define INSTANTIATE_INT_TYPE |
( |
|
Type | ) |
|
Value: template Type ArgsManager::GetArg<Type>(const std::string&, Type) const; \
template std::optional<Type> ArgsManager::GetArg<Type>(const std::string&) const; \
constexpr auto Ticks(Dur2 d)
Helper to count the seconds of a duration/time_point.
Definition at line 578 of file args.cpp.
◆ CheckDataDirOption()
◆ GetDefaultDataDir()
◆ HasTestOption()
| bool HasTestOption |
( |
const ArgsManager & |
args, |
|
|
const std::string & |
test_option |
|
) |
| |
Checks if a particular test option is present in -test command-line arg options.
Definition at line 834 of file args.cpp.
◆ HelpMessageGroup()
| std::string HelpMessageGroup |
( |
const std::string & |
message | ) |
|
Format a string to be used as group of options in help messages.
- Parameters
-
| message | Group name (e.g. "RPC server options:") |
- Returns
- the formatted string
Definition at line 806 of file args.cpp.
◆ HelpMessageOpt()
Format a string to be used as option description in help messages.
- Parameters
-
| option | Option name (e.g. "-rpcuser") |
| help_param | Help parameter (e.g. "=<user>" or "") |
| message | Option description (e.g. "Username for JSON-RPC connections") |
| subopt | True if this is a suboption, instead of a top-level option. |
- Returns
- the formatted string
Definition at line 810 of file args.cpp.
◆ HelpRequested()
- Returns
- true if help has been requested via a command-line arg
Definition at line 795 of file args.cpp.
◆ INSTANTIATE_INT_TYPE() [1/8]
◆ INSTANTIATE_INT_TYPE() [2/8]
◆ INSTANTIATE_INT_TYPE() [3/8]
◆ INSTANTIATE_INT_TYPE() [4/8]
| INSTANTIATE_INT_TYPE |
( |
int8_t |
| ) |
|
◆ INSTANTIATE_INT_TYPE() [5/8]
◆ INSTANTIATE_INT_TYPE() [6/8]
◆ INSTANTIATE_INT_TYPE() [7/8]
◆ INSTANTIATE_INT_TYPE() [8/8]
◆ InterpretBool()
| static bool InterpretBool |
( |
const std::string & |
strValue | ) |
|
|
static |
Interpret a string argument as a boolean.
The definition of LocaleIndependentAtoi<int>() requires that non-numeric string values like "foo", return 0. This means that if a user unintentionally supplies a non-integer argument here, the return value is always false. This means that -foo=false does what the user probably expects, but -foo=true is well defined but does not do what they probably expected.
The return value of LocaleIndependentAtoi<int>(...) is zero when given input not representable as an int.
For a more extensive discussion of this topic (and a wide range of opinions on the Right Way to change this code), see PR12713.
Definition at line 55 of file args.cpp.
◆ InterpretKey()
| KeyInfo InterpretKey |
( |
std::string |
key | ) |
|
Parse "name", "section.name", "noname", "section.noname" settings keys.
- Note
- Where an option was negated can be later checked using the IsArgNegated() method. One use case for this is to have a way to disable options that are not normally boolean (e.g. using -nodebuglogfile to request that debug log output is not sent to any file at all).
Definition at line 75 of file args.cpp.
◆ InterpretValue()
Interpret settings value based on registered flags.
- Parameters
-
| [in] | key | key information to know if key was negated |
| [in] | value | string value of setting to be parsed |
| [in] | flags | ArgsManager registered argument flags |
| [out] | error | Error description if settings value is not valid |
- Returns
- parsed settings value if it is valid, otherwise nullopt accompanied by a descriptive error string
Definition at line 103 of file args.cpp.
◆ SaveErrors()
◆ SettingName()
| static std::string SettingName |
( |
const std::string & |
arg | ) |
|
|
static |
◆ SettingTo()
◆ SettingToBool()
◆ SettingToString()
◆ SetupHelpOptions()
Add help options to the args manager.
Definition at line 800 of file args.cpp.
◆ BITCOIN_CONF_FILENAME
| const char* const BITCOIN_CONF_FILENAME = "bitcoin.conf" |
◆ BITCOIN_SETTINGS_FILENAME
| const char* const BITCOIN_SETTINGS_FILENAME = "settings.json" |
◆ gArgs
◆ TEST_OPTIONS_DOC
Initial value:{
"addrman (use deterministic addrman)",
"reindex_after_failure_noninteractive_yes (When asked for a reindex after failure interactively, simulate as-if answered with 'yes')",
"bip94 (enforce BIP94 consensus rules)",
}
Definition at line 828 of file args.cpp.