bsd-getopt 0.1.2

A minimal BSD-style getopt implementation in Rust
Documentation
  • Coverage
  • 50%
    4 out of 8 items documented4 out of 4 items with examples
  • Size
  • Source code size: 11.47 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 309.15 kB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 1m 6s Average build duration of successful builds.
  • all releases: 50s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Numbchenchen/bsd-getopt
    0 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • Numbchenchen

bsd-getopt

A small BSD-style getopt implementation in Rust.

Features

  • Short options (-a, -b value)
  • Grouped options (-abc)
  • Option arguments (-ovalue or -o value)
  • -- terminator

Example

use bsd_getopt::Getopt;

let args = vec![
    "prog".to_string(),
    "-a".to_string(),
    "-bfoo".to_string(),
];

let mut g = Getopt::new("ab:", args);

while let Some(opt) = g.next() {
    println!("opt: {}, arg: {:?}", opt, g.optarg);
}