| Crates.io | lino-arguments |
| lib.rs | lino-arguments |
| version | 0.1.1 |
| created_at | 2026-01-13 21:59:59.036186+00 |
| updated_at | 2026-01-13 21:59:59.036186+00 |
| description | A unified configuration library combining environment variables and CLI arguments with a clear priority chain |
| homepage | |
| repository | https://github.com/link-foundation/lino-arguments |
| max_upload_size | |
| id | 2041473 |
| size | 43,569 |
A unified configuration library combining environment variables and CLI arguments with a clear priority chain.
lino-arguments provides a unified configuration system that automatically loads configuration from multiple sources with a clear priority chain:
Add to your Cargo.toml:
[dependencies]
lino-arguments = "0.1"
use clap::Parser;
use lino_arguments::{getenv, getenv_int, getenv_bool};
#[derive(Parser)]
struct Args {
#[arg(short, long, default_value_t = getenv_int("PORT", 3000) as u16)]
port: u16,
#[arg(short, long, default_value = getenv("API_KEY", ""))]
api_key: String,
#[arg(short, long, default_value_t = getenv_bool("VERBOSE", false))]
verbose: bool,
}
fn main() {
let args = Args::parse();
println!("Server starting on port {}", args.port);
}
getenv(key, default)Get environment variable as string with case-insensitive lookup.
let api_key = getenv("apiKey", "default-key"); // Tries API_KEY, apiKey, etc.
getenv_int(key, default)Get environment variable as integer.
let port = getenv_int("PORT", 3000);
getenv_bool(key, default)Get environment variable as boolean. Accepts: "true", "false", "1", "0", "yes", "no".
let debug = getenv_bool("DEBUG", false);
to_upper_case(s) - Convert to UPPER_CASEto_camel_case(s) - Convert to camelCaseto_kebab_case(s) - Convert to kebab-caseto_snake_case(s) - Convert to snake_caseto_pascal_case(s) - Convert to PascalCaseuse lino_arguments::{to_upper_case, to_camel_case, to_kebab_case};
assert_eq!(to_upper_case("apiKey"), "API_KEY");
assert_eq!(to_camel_case("api-key"), "apiKey");
assert_eq!(to_kebab_case("apiKey"), "api-key");
# Run all tests
cargo test
# Run tests with output
cargo test -- --nocapture
# Run specific test
cargo test case_conversion
# Build
cargo build
# Build release
cargo build --release
# Run clippy
cargo clippy
# Format code
cargo fmt
This is free and unencumbered software released into the public domain. See the LICENSE file for details.