#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

#210 in #settings

Download history 90/week @ 2024-07-22 100/week @ 2024-07-29 133/week @ 2024-08-05 84/week @ 2024-08-12 88/week @ 2024-08-19 122/week @ 2024-08-26 88/week @ 2024-09-02 63/week @ 2024-09-09 97/week @ 2024-09-16 127/week @ 2024-09-23 67/week @ 2024-09-30 94/week @ 2024-10-14 52/week @ 2024-10-21 49/week @ 2024-10-28 73/week @ 2024-11-04

268 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
~834K SLoC