flagtory 0.2.1

a simple library to make command line flags.
Documentation
  • Coverage
  • 44.44%
    4 out of 9 items documented0 out of 0 items with examples
  • Size
  • Source code size: 12.2 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 372.2 kB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 8s Average build duration of successful builds.
  • all releases: 8s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Homepage
  • akbarilmnn/flagtory
    0 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • akbarilmnn

Crates.io Documentation dependency status

Flagtory

a simple library to make command line flags. This library provides the user to make their own command line flags easily. This library's API model is inspired by Go's flag package which has a simple interface to the users.

Examples

    // bring the module into scope     
    use flagtory::Flags;

    // initialize the flags struct
    let flags = Flags::new();

    // add your flags using the add method 
    // this returns a mutable reference to the value 
    let bool_ref = flags.add("f","this is my flag", true);
    
    assert_eq!(*bool_ref, true);

    // you can change the value as long it's the same type 
    *bool_ref = false;

    assert_eq!(*bool_ref, false);

Currently, flagtory only accept values that implements the std::str::FromStr and std::any::Any trait. Which is wrapped by the Flag trait which is why &str is not implemented in the Flag trait, use String instead. and there are some limitations around how a user can create their own flags which is parsable. See here Please use the latest version to get the best experience.