Skip to content
This repository has been archived by the owner on Aug 27, 2023. It is now read-only.

akbarilmnn/flagtory

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

a small library to make command line flags.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages