StructConf

Combine argument parsing with a config file at compile time. Build Status docs.rs version

StructConf is a small derive macro that allows you to combine argument parsing from clap and config file parsing from rust-ini at compile time. It's inspired by the argument parser structopt, and developed to be used in Vidify.

StructConf aims to be relatively small and simple. Here are its current selling points:

Small example:

```rust use clap::App; use structconf::StructConf;

[derive(Debug, StructConf)]

struct ServerConfig { #[conf(help = "The public key")] pub publickey: String, #[conf(nofile, long = "your-secret", help = "Your secret API key")] pub secret_key: String, #[conf(default = "100", help = "timeout in seconds")] pub timeout: i32, }

pub fn main() { let app = App::new("demo"); let conf = ServerConfig::parse(app, "config.ini"); println!("Parsed config: {:#?}", conf); } ```

For more details on how to use Structconf, read the docs and check out the examples.