use-flag 0.0.1

Primitive short and long flag types for RustUse CLI-adjacent code
Documentation
  • Coverage
  • 100%
    28 out of 28 items documented1 out of 21 items with examples
  • Size
  • Source code size: 10.57 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 628.58 kB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 6s Average build duration of successful builds.
  • all releases: 6s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Homepage
  • RustUse/use-cli
    1 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • CloudBranch

use-flag

Primitive short, long, and boolean flag types for CLI-adjacent Rust code.

use-flag validates flag names and stores flag intent. It does not scan an argv stream, expand combined short flags, define negation policy, or implement a parser.

Example

use use_flag::{BooleanFlag, Flag};

let flag = Flag::try_from_token("--verbose")?;
let verbose = BooleanFlag::enabled(flag);

assert!(verbose.is_enabled());
assert_eq!(verbose.flag().to_token(), "--verbose");
# Ok::<(), use_flag::FlagNameError>(())

Scope

Use this crate for small flag vocabulary. Use a parser framework when you need parsing, validation across multiple tokens, or derived command definitions.