ArgsManager

Parses and stores command-line and configuration file arguments.

Synopsis

Declared in <common/args.h>

class ArgsManager;

Types

NameDescription
Command A parsed command together with its arguments.

Enums

NameDescription
Flags Flags controlling how config and command line arguments are validated and interpreted.

Member Functions

NameDescription
ArgsManager [constructor]Construct an argument manager with no arguments registered.
~ArgsManager [destructor]Destroy the argument manager.
AddArg Add argument
AddCommand Add command
AddHiddenArgs Add many hidden arguments
CheckCommandOptions Check that any command-specific options the user specified are valid for the given command.
CheckMultipleCLIArgs Check CLI command args
ClearArgs Clear available arguments
ClearPathCache Clear cached directory paths
ForceSetArg Forces an arg setting. Called by SoftSetArg() if the arg hasn't already been set. Also called directly in testing.
GetArg GetArg overloads
GetArgFlags Return Flags for known arg. Return default flags for unknown arg.
GetArgs Return a vector of strings of the given argument
GetBlocksDirPath Get blocks directory path
GetBoolArg GetBoolArg overloads
GetChainType Returns the appropriate chain type from the program arguments.
GetChainTypeString Returns the appropriate chain type string from the program arguments.
GetCommand Get the command and command args (returns std::nullopt if no command provided)
GetConfigFilePath Return config file path (read-only)
GetDataDirBase Get data directory path
GetDataDirNet Get data directory path with appended network identifier
GetHelpMessage Get the help string
GetIntArg GetIntArg overloads
GetPathArg Return path argument or default value
GetPersistentSetting Get current setting from config file or read/write settings file, ignoring nonpersistent command line or forced settings values.
GetSetting Get setting value.
GetSettingsList Get list of setting values.
GetSettingsPath Get settings file path, or return false if read-write settings were disabled with -nosettings.
GetUnrecognizedSections Log warnings for unrecognized section names in the config file.
GetUnsuitableSectionOnlyArgs Log warnings for options in m_section_only_args when they are specified in the default section but not overridden on the command line or in a network-specific section in the config file.
IsArgNegated Return true if the argument was originally passed as a negated option, i.e. -nofoo.
IsArgSet Return true if the given argument has been manually set
LockSettings Access settings with lock held.
LogArgs Log the config file options and the command line arguments, useful for troubleshooting.
ParseParameters Parse command-line parameters into settings.
ReadConfigFiles Read and interpret the configuration files.
ReadSettingsFile Read settings file. Push errors to vector, or log them if null.
SelectConfigNetwork Select the network in use
SetConfigFilePath Set the path used for the configuration file.
SetDefaultFlags Set default flags to return for an unknown arg.
SoftSetArg Set an argument if it doesn't already have a value
SoftSetBoolArg Set a boolean argument if it doesn't already have a value
WriteSettingsFile Write settings file or backup settings file. Push errors to vector, or log them if null.

Protected Member Functions

NameDescription
ReadConfigStream Read and interpret configuration settings from a stream.
ReadConfigString Read and interpret configuration settings from a string.

Non-Member Functions

NameDescription
AbsPathForConfigValMost paths passed as configuration arguments are treated as relative to the datadir if they are not absolute.
AppInitBasicSetupInitialize bitcoin core: Basic context setup.
AppInitParameterInteractionInitialization: parameter interaction.
ApplyArgsManOptionsOverlay the options set in argsman on top of corresponding members in mempool_opts. Returns an error if one was encountered.
BlockPolicyFeeEstPathPath of the block policy fee estimator data file.
CheckDataDirOptionReturn true if -datadir option points to a valid directory or is not specified.
CreateChainParamsCreates and returns a std::unique_ptr<CChainParams> of the chosen chain.
DumpPeerAddressesWrites the peer address database (peers.dat) to disk.
EnsureAnyArgsmanGet the argument manager from an opaque RPC context, asserting it is present.
EnsureArgsmanGet the argument manager from a node context, asserting it is present.
HasTestOptionChecks if a particular test option is present in -test command-line arg options
HelpRequestedReturn whether the user asked for help on the command line.
InitLoggingInitialize the logging infrastructure
InitParameterInteractionParameter interaction: change current parameters depending on various rules
MaybeMigrateLegacyFeeEstimatesMove a legacy fee_estimates.dat file to the current block policy fee estimator path, if needed.
MempoolPolicyEstimatorPathPath of the mempool policy estimator data file.
SetupChainParamsBaseOptionsSet the arguments for chainparams
SetupHelpOptionsAdd help options to the args manager
SetupServerArgsRegister all arguments with the ArgsManager
common::InitConfigRead config files, and create datadir and settings.json if they don't exist.
init::AddLoggingArgsRegisters the logging-related command-line options with the argument manager.
init::SetLoggingCategoriesEnables or disables the debug logging categories selected by the arguments.
init::SetLoggingLevelSets the global logging severity level selected by the arguments.
init::SetLoggingOptionsApplies the general logging options (log file, timestamps, thread names, and similar flags) parsed from the arguments to the global logger.
init::StartLoggingOpens the debug log file and begins writing buffered log messages.
node::ApplyArgsManOptionsApply block-storage options taken from the argument manager.
node::ApplyArgsManOptionsApply peer-manager options taken from the argument manager.
node::ApplyArgsManOptionsApply chainstate-manager options taken from the argument manager.
node::CalculateCacheSizesSplit the configured total database cache across the indexes and kernel caches.
node::LogOversizedDbCacheLog a warning when the configured database cache is larger than available RAM allows.
node::MempoolPathReturn the on-disk path used to load and save the persisted mempool.
node::ReadCoinsViewArgsRead coins-view database options from the argument manager.
node::ReadDatabaseArgsRead database options from the argument manager.
node::ReadMiningArgsRead the mining options set in args. Returns an error if one was encountered.
node::ReadNotificationArgsApply notification-related options from the argument manager.
node::ShouldPersistMempoolDetermine whether the mempool should be persisted across restarts.
wallet::CreateFromDumpCreates a new wallet database from a previously dumped file.
wallet::DumpWalletDumps the records of a wallet database to a human-readable file.
wallet::ReadDatabaseArgsFills database options from command-line arguments.
wallet::WalletTool::ExecuteWalletToolFuncRuns a wallet-tool command such as create, info, or dump.