# rclap
> rclap is a configuration helper based on clap. It is designed to expose the requirement as config files, environment variables, and command line arguments with the least amount of boilerplate code.
> Macro clap generator based on toml files
# Usage
## simple toml file
```toml
port = { type = "u16", default = "8080", doc = "Server port number", env = "PORT" }
id = { type = "u16", default = "2", doc = "Server id number", env = "ID", optional = true }
```
Then the config struct can be generated by the following code
```rust
use clap::Parser;
use rclap::config;
#[config]
struct MyConfig;
fn main() {
let config = MyConfig::parse();
println!("Config: {:#?}", config);
println!("{}", &config.port);
}
```