Expand description
clyops — declarative CLI parsing. Behavior follows spec/SPEC.md.
use clyops::Cli;
let mut cli = Cli::new();
cli.arg("input", "Input file", "", "path");
cli.opt("PORT", "port", "p", "8080", "Server port").group("Network").rule("port");
cli.opt("VERBOSE", "verbose", "v", "flag", "Verbose output");
let args = cli.run();
println!("{} {} {}", args.str("input"), args.int("PORT"), args.bool("VERBOSE"));Structs§
- ArgRef
- Handle returned by
Cli::argfor an optional rule on the same line. - Cli
- A program CLI. Register options and arguments before parsing; registration errors panic.
- OptRef
- Handle returned by
Cli::optand friends for optional settings on the same line. - Values
- Resolved values keyed by option var and argument name, in registration order.
Enums§
- Parsed
- Outcome of
Cli::parse. - Value
- A resolved, typed value.
Functions§
- describe_
rule - Help text for a validation rule (spec section 5).
- die
- Print an error and exit with
code. Never suppressed. - error
- Write an error message to stderr unless silent.
- info
- Write an informational message to stderr unless silent.
- resolve_
path - Resolve a path value against
base(spec section 6). - set_
silent - Suppress info/warn/error/success output (die and parse errors still print).
- success
- Write a success message to stderr unless silent.
- validate
- Validate
valueagainstruleand convert it to its typed form. The error is the spec’s error text. - warn
- Write a warning to stderr unless silent.
- wrap_
text - Greedy word wrap that keeps existing line breaks (spec section 7).