Struct bitcoin_argsman::ArgsManagerInner
source · pub struct ArgsManagerInner {
pub settings: Settings,
pub command: Vec<String>,
pub network: Option<String>,
pub network_only_args: HashSet<String>,
pub available_args: HashMap<OptionsCategory, HashMap<String, ArgsManagerArg>>,
pub accept_any_command: bool,
pub config_sections: LinkedList<SectionInfo>,
pub cached_blocks_path: Option<Box<Path>>,
pub cached_datadir_path: Option<Box<Path>>,
pub cached_network_datadir_path: Option<Box<Path>>,
}Fields§
§settings: Settings§command: Vec<String>§network: Option<String>§network_only_args: HashSet<String>§available_args: HashMap<OptionsCategory, HashMap<String, ArgsManagerArg>>§accept_any_command: bool§config_sections: LinkedList<SectionInfo>§cached_blocks_path: Option<Box<Path>>§cached_datadir_path: Option<Box<Path>>§cached_network_datadir_path: Option<Box<Path>>Implementations§
source§impl ArgsManagerInner
impl ArgsManagerInner
sourcepub fn add_command(&mut self, cmd: &str, help: &str)
pub fn add_command(&mut self, cmd: &str, help: &str)
| Add subcommand |
sourcepub fn add_arg(&mut self, x: &ArgDescriptor)
pub fn add_arg(&mut self, x: &ArgDescriptor)
| Add argument |
| Add many hidden arguments |
pub fn setup_cli_args(&mut self)
source§impl ArgsManagerInner
impl ArgsManagerInner
sourcepub fn setup_chain_params_base_options(&mut self)
pub fn setup_chain_params_base_options(&mut self)
| Set the arguments for chainparams |
source§impl ArgsManagerInner
impl ArgsManagerInner
sourcepub fn clear_args(&mut self)
pub fn clear_args(&mut self)
| Clear available arguments |
sourcepub fn clear_path_cache(&mut self)
pub fn clear_path_cache(&mut self)
| Clear cached directory paths |
source§impl ArgsManagerInner
impl ArgsManagerInner
pub fn get_arg_flags(&self, name: &str) -> Option<u32>
pub fn get_args(&self, str_arg: &str) -> Vec<String>
pub fn get_arg(&self, str_arg: &str, str_default: &str) -> String
sourcepub fn get_int_arg(&self, str_arg: &str, n_default: i64) -> i64
pub fn get_int_arg(&self, str_arg: &str, n_default: i64) -> i64
| Return integer argument or default | value | | ———– | @param strArg | | Argument to get (e.g. “-foo”) | ––––– | @param nDefault | | (e.g. 1) | | ———– | @return | | command-line argument (0 if invalid | number) or default value |
sourcepub fn get_bool_arg(&self, str_arg: &str, default: bool) -> bool
pub fn get_bool_arg(&self, str_arg: &str, default: bool) -> bool
| Return boolean argument or default | value | | ———– | @param strArg | | Argument to get (e.g. “-foo”) | ––––– | @param fDefault | | (true or false) | | ———– | @return | | command-line argument or default value |
source§impl ArgsManagerInner
impl ArgsManagerInner
sourcepub fn get_blocks_dir_path(&self) -> Box<Path>
pub fn get_blocks_dir_path(&self) -> Box<Path>
| Get blocks directory path | | ———– | @return | | Blocks path which is network specific |
source§impl ArgsManagerInner
impl ArgsManagerInner
sourcepub fn get_chain_name(&mut self) -> Result<String, StdException>
pub fn get_chain_name(&mut self) -> Result<String, StdException>
| Returns the appropriate chain name | from the program arguments. | | | ———– | @return | | CBaseChainParams::MAIN by default; | raises runtime error if an invalid combination | is given. |
source§impl ArgsManagerInner
impl ArgsManagerInner
sourcepub fn get_command(&self) -> Option<ArgsManagerCommand>
pub fn get_command(&self) -> Option<ArgsManagerCommand>
| Get the command and command args (returns | std::nullopt if no command provided) |
source§impl ArgsManagerInner
impl ArgsManagerInner
sourcepub fn get_data_dir_base(&self) -> PathBuf
pub fn get_data_dir_base(&self) -> PathBuf
| Get data directory path | | | ———– | @return | | Absolute path on success, otherwise | an empty path when a non-directory path | would be returned @post Returned directory | path is created unless it is empty |
sourcepub fn get_data_dir_net(&self) -> PathBuf
pub fn get_data_dir_net(&self) -> PathBuf
| Get data directory path with appended | network identifier | | ———– | @return | | Absolute path on success, otherwise | an empty path when a non-directory path | would be returned @post Returned directory | path is created unless it is empty |
sourcepub fn get_data_dir(&self, net_specific: bool) -> PathBuf
pub fn get_data_dir(&self, net_specific: bool) -> PathBuf
| Get data directory path | | ———– | @param net_specific | | Append network identifier to the returned | path | | ———– | @return | | Absolute path on success, otherwise | an empty path when a non-directory path | would be returned @post Returned directory | path is created unless it is empty |
source§impl ArgsManagerInner
impl ArgsManagerInner
sourcepub fn get_help_message(&self) -> String
pub fn get_help_message(&self) -> String
| Get the help string |
source§impl ArgsManagerInner
impl ArgsManagerInner
sourcepub fn get_settings_path(
&self,
filepath: Option<&mut Box<Path>>,
temp: Option<bool>
) -> bool
pub fn get_settings_path( &self, filepath: Option<&mut Box<Path>>, temp: Option<bool> ) -> bool
| Get settings file path, or return false | if read-write settings were disabled | with -nosettings. |
sourcepub fn get_setting(&self, arg: &str) -> SettingsValue
pub fn get_setting(&self, arg: &str) -> SettingsValue
| Get setting value. | | Result will be null if setting was unset, | true if “-setting” argument was passed | false if “-nosetting” argument was | passed, and a string if a “-setting=value” | argument was passed. |
sourcepub fn get_settings_list(&self, arg: &str) -> Vec<SettingsValue>
pub fn get_settings_list(&self, arg: &str) -> Vec<SettingsValue>
| Get list of setting values. |
source§impl ArgsManagerInner
impl ArgsManagerInner
sourcepub fn get_unrecognized_sections(&self) -> LinkedList<SectionInfo>
pub fn get_unrecognized_sections(&self) -> LinkedList<SectionInfo>
| Log warnings for unrecognized section | names in the config file. |
source§impl ArgsManagerInner
impl ArgsManagerInner
sourcepub fn help_requested(&self) -> bool
pub fn help_requested(&self) -> bool
| @return | | true if help has been requested via a | command-line arg |
sourcepub fn setup_help_options(&mut self)
pub fn setup_help_options(&mut self)
| Add help options to the args manager |
source§impl ArgsManagerInner
impl ArgsManagerInner
sourcepub fn log_args_prefix(
&self,
prefix: &str,
section: &str,
args: &HashMap<String, Vec<SettingsValue>>
)
pub fn log_args_prefix( &self, prefix: &str, section: &str, args: &HashMap<String, Vec<SettingsValue>> )
| Helper function for LogArgs(). |
source§impl ArgsManagerInner
impl ArgsManagerInner
sourcepub fn is_arg_set(&self, str_arg: &str) -> bool
pub fn is_arg_set(&self, str_arg: &str) -> bool
| Return true if the given argument has | been manually set | | ———– | @param strArg | | Argument to get (e.g. “-foo”) | | ———– | @return | | true if the argument has been set |
sourcepub fn is_arg_negated(&self, str_arg: &str) -> bool
pub fn is_arg_negated(&self, str_arg: &str) -> bool
| Return true if the argument was originally | passed as a negated option, i.e. -nofoo. | | ———– | @param strArg | | Argument to get (e.g. “-foo”) | | ———– | @return | | true if the argument was passed negated |
source§impl ArgsManagerInner
impl ArgsManagerInner
sourcepub fn select_config_network(&mut self, network: &str)
pub fn select_config_network(&mut self, network: &str)
| Select the network in use |
source§impl ArgsManagerInner
impl ArgsManagerInner
sourcepub fn lock_settings<F: Fn(&Settings)>(&mut self, fn_: F)
pub fn lock_settings<F: Fn(&Settings)>(&mut self, fn_: F)
| Access settings with lock held. |
sourcepub fn init_settings(&mut self, error: &mut String) -> Result<(), String>
pub fn init_settings(&mut self, error: &mut String) -> Result<(), String>
| Read and update settings file with saved | settings. This needs to be called after | SelectParams() because the settings | file location is network-specific. |
sourcepub fn read_settings_file(&mut self, errors: Option<&mut Vec<String>>) -> bool
pub fn read_settings_file(&mut self, errors: Option<&mut Vec<String>>) -> bool
| Read settings file. Push errors to vector, | or log them if null. |
sourcepub fn write_settings_file(
&self,
errors: Option<&mut Vec<String>>
) -> Result<bool, StdException>
pub fn write_settings_file( &self, errors: Option<&mut Vec<String>> ) -> Result<bool, StdException>
| Write settings file. Push errors to | vector, or log them if null. |
source§impl ArgsManagerInner
impl ArgsManagerInner
sourcepub fn soft_set_arg(&mut self, str_arg: &str, str_value: &str) -> bool
pub fn soft_set_arg(&mut self, str_arg: &str, str_value: &str) -> bool
| Set an argument if it doesn’t already | have a value | | ———– | @param strArg | | Argument to set (e.g. “-foo”) | ––––– | @param strValue | | Value (e.g. “1”) | | ———– | @return | | true if argument gets set, false if it | already had a value |
sourcepub fn force_set_arg(&mut self, str_arg: &str, str_value: &str)
pub fn force_set_arg(&mut self, str_arg: &str, str_value: &str)
| Forces an arg setting. Called by | | SoftSetArg() if the arg hasn’t already | been set. Also called directly in testing. |
sourcepub fn soft_set_bool_arg(&mut self, str_arg: &str, value: bool) -> bool
pub fn soft_set_bool_arg(&mut self, str_arg: &str, value: bool) -> bool
| Set a boolean argument if it doesn’t | already have a value | | ———– | @param strArg | | Argument to set (e.g. “-foo”) | ––––– | @param fValue | | Value (e.g. false) | | ———– | @return | | true if argument gets set, false if it | already had a value |
source§impl ArgsManagerInner
impl ArgsManagerInner
sourcepub fn use_default_section(&self, arg: &str) -> bool
pub fn use_default_section(&self, arg: &str) -> bool
| Returns true if settings values from | the default section should be used, | depending on the current network and | whether the setting is network-specific. |