4 releases

0.1.3 Aug 31, 2022
0.1.2 Aug 31, 2022
0.1.1 Aug 30, 2022
0.1.0 Aug 30, 2022

#2529 in Parser implementations

Download history 52/week @ 2024-03-16 73/week @ 2024-03-23 17/week @ 2024-03-30 37/week @ 2024-04-06 49/week @ 2024-04-13 38/week @ 2024-04-20 27/week @ 2024-04-27 59/week @ 2024-05-04 33/week @ 2024-05-11 37/week @ 2024-05-18 42/week @ 2024-05-25 23/week @ 2024-06-01 14/week @ 2024-06-08 15/week @ 2024-06-15 24/week @ 2024-06-22 2/week @ 2024-06-29

59 downloads per month
Used in drawbridge

Apache-2.0

17KB
349 lines

Description

confargs is a Rust library, which parses a configuration file in arbitrary format into a iterator of command-line arguments. The main use case for this is to add configuration file support for CLI tools and argument parsers, which do not have support for configuration files.

Compatibility

This project primarily aims at compatibility with clap, which is tested automatically in CI. Other libraries should work as well, but that is not tested.

Examples

Examples are provided in examples directory along an example configuration files in supported formats.

clap

From the root of the repository:

$ cargo run -q --example clap    
Args { string: "string", integer: 42, float: 42.2, array: [] }
$ cargo run -q --example clap -- @examples/conf.toml
Args { string: "conf", integer: -42, float: -42.2, array: ["test", "config"] }

lib.rs:

Parse a configuration file in arbitrary format into a iterator of command-line arguments.

The main use case for this crate is to add configuration file support for CLI tools and argument parsers, which do not have support for configuration files (for example, clap)

Dependencies

~340–620KB
~13K SLoC