rclap 0.1.0

rclap is a Rust configuration utility to help to generate the clap structures. The main purpose is to reduce boilerplate code when using clap and expose the configuration requirements as a toml file.
Documentation

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

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

use clap::Parser;
use rclap::config;

#[config]
struct MyConfig;
fn main() {
    let config = MyConfig::parse();
    println!("Config: {:#?}", config);
    println!("{}", &config.port);
}