Parses and stores command‐line and configuration file arguments.

Synopsis

Declared in <common/args.h>

class ArgsManager;

Types

Name

Description

Command

A parsed command together with its arguments.

Enums

Name

Description

Flags

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

Member Functions

Name

Description

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

Name

Description

ReadConfigStream

Read and interpret configuration settings from a stream.

ReadConfigString

Read and interpret configuration settings from a string.

Non-Member Functions

Name

Description

AbsPathForConfigVal

Most paths passed as configuration arguments are treated as relative to the datadir if they are not absolute.

AppInitBasicSetup

Initialize bitcoin core: Basic context setup.

AppInitParameterInteraction

Initialization: parameter interaction.

ApplyArgsManOptions

Overlay the options set in argsman on top of corresponding members in mempool_opts. Returns an error if one was encountered.

BlockPolicyFeeEstPath

Path of the block policy fee estimator data file.

CheckDataDirOption

Return true if ‐datadir option points to a valid directory or is not specified.

CreateChainParams

Creates and returns a std::unique_ptr<CChainParams> of the chosen chain.

DumpPeerAddresses

Writes the peer address database (peers.dat) to disk.

EnsureAnyArgsman

Get the argument manager from an opaque RPC context, asserting it is present.

EnsureArgsman

Get the argument manager from a node context, asserting it is present.

HasTestOption

Checks if a particular test option is present in ‐test command‐line arg options

HelpRequested

Return whether the user asked for help on the command line.

InitLogging

Initialize the logging infrastructure

InitParameterInteraction

Parameter interaction: change current parameters depending on various rules

MaybeMigrateLegacyFeeEstimates

Move a legacy fee_estimates.dat file to the current block policy fee estimator path, if needed.

MempoolPolicyEstimatorPath

Path of the mempool policy estimator data file.

SetupChainParamsBaseOptions

Set the arguments for chainparams

SetupHelpOptions

Add help options to the args manager

SetupServerArgs

Register all arguments with the ArgsManager

common::InitConfig

Read config files, and create datadir and settings.json if they don't exist.

init::AddLoggingArgs

Registers the logging‐related command‐line options with the argument manager.

init::SetLoggingCategories

Enables or disables the debug logging categories selected by the arguments.

init::SetLoggingLevel

Sets the global logging severity level selected by the arguments.

init::SetLoggingOptions

Applies the general logging options (log file, timestamps, thread names, and similar flags) parsed from the arguments to the global logger.

init::StartLogging

Opens the debug log file and begins writing buffered log messages.

node::ApplyArgsManOptions

Apply block‐storage options taken from the argument manager.

node::ApplyArgsManOptions

Apply peer‐manager options taken from the argument manager.

node::ApplyArgsManOptions

Apply chainstate‐manager options taken from the argument manager.

node::CalculateCacheSizes

Split the configured total database cache across the indexes and kernel caches.

node::LogOversizedDbCache

Log a warning when the configured database cache is larger than available RAM allows.

node::MempoolPath

Return the on‐disk path used to load and save the persisted mempool.

node::ReadCoinsViewArgs

Read coins‐view database options from the argument manager.

node::ReadDatabaseArgs

Read database options from the argument manager.

node::ReadMiningArgs

Read the mining options set in args. Returns an error if one was encountered.

node::ReadNotificationArgs

Apply notification‐related options from the argument manager.

node::ShouldPersistMempool

Determine whether the mempool should be persisted across restarts.

wallet::CreateFromDump

Creates a new wallet database from a previously dumped file.

wallet::DumpWallet

Dumps the records of a wallet database to a human‐readable file.

wallet::ReadDatabaseArgs

Fills database options from command‐line arguments.

wallet::WalletTool::ExecuteWalletToolFunc

Runs a wallet‐tool command such as create, info, or dump.

Created with MrDocs