#arguments #bitcoin #configuration #settings #parameters #flags #manager

nightly bitcoin-argsman

a manager for config and environment arguments

5 releases

0.1.16-alpha.0 Mar 31, 2023
0.1.14-alpha.0 Mar 18, 2023
0.1.13-alpha.0 Mar 17, 2023
0.1.12-alpha.0 Jan 18, 2023
0.1.10-alpha.0 Jan 18, 2023

#196 in #settings

Download history 88/week @ 2024-01-02 121/week @ 2024-01-09 108/week @ 2024-01-16 72/week @ 2024-01-23 23/week @ 2024-01-30 74/week @ 2024-02-06 122/week @ 2024-02-13 152/week @ 2024-02-20 111/week @ 2024-02-27 99/week @ 2024-03-05 138/week @ 2024-03-12 131/week @ 2024-03-19 241/week @ 2024-03-26 151/week @ 2024-04-02 96/week @ 2024-04-09 146/week @ 2024-04-16

665 downloads per month
Used in 56 crates (22 directly)

MIT license

1MB
4.5K SLoC

bitcoin-argsman

A Rust crate for managing command-line arguments and configurations for the Bitcoin system. This crate is in the process of being translated from C++ to Rust, and some of the function bodies are still in the process of translation.

This crate provides a set of tools for parsing and interpreting command-line arguments and configuration files, as well as managing and validating settings for the Bitcoin system. The crate contains a number of types and functions that allow for easy management of various configuration options and parameters.

Some of the key features of this crate include:

  • ArgsManager: A struct for managing command-line arguments and configuration files.

  • ArgDescriptor: A struct for describing a single argument or option.

  • OptionsCategory: A struct for grouping related command-line arguments.

  • BaseChainParams: A struct for managing settings related to the Bitcoin blockchain.

  • SectionInfo: A struct for managing information about a configuration file section.

  • ArgsManagerFlags: A set of bitflags for controlling various aspects of ArgsManager.

  • ArgsManagerCommand: A struct for defining a subcommand of the bitcoin-argsman command-line tool.

Some of the mathematical ideas behind this crate include the use of bitflags for efficient storage and manipulation of Boolean flags, as well as the use of structs and functions for managing and manipulating various types of data.

The following are some of the key functions and methods provided by this crate:

  • get_data_dir(): Returns the path to the Bitcoin data directory.

  • get_data_dir_base(): Returns the base path of the data directory.

  • get_data_dir_net(): Returns the path to the data directory for a specific Bitcoin network.

  • get_default_data_dir(): Returns the default path to the Bitcoin data directory.

  • get_home_dir(): Returns the path to the user's home directory.

  • strip_redundant_last_elements_of_path(): Removes redundant elements from the end of a path.

  • parse_parameters(): Parses command-line arguments into a set of ArgDescriptor objects.

  • read_config_files(): Reads configuration files into memory and returns them as a vector of SectionInfo objects.

  • read_config_stream(): Reads a single configuration file stream into memory and returns it as a SectionInfo object.

  • select_config_network(): Selects the appropriate configuration network based on the command-line arguments.

  • write_settings_file(): Writes the current settings to a configuration file.

Overall, bitcoin-argsman provides a powerful and flexible set of tools for managing and interpreting command-line arguments and configuration files for the Bitcoin system.

Dependencies

~88MB
~827K SLoC