cok 0.1.10

A simple to use, efficient, Command Line Argument Parser
Documentation

A simple to use, efficient, Command Line Argument Parser

Crates.io Rust license

Example

create cli.json

{
    "name":"git",
    "version":"0.1.1",
    "authors":["Anonymous <dnrops@anonymous.com>"],
    "about":"A git cli",
    "args":[
        {
            "arg":"--init",
            "short":"-i",
            "required":false,
            "about":"Create an empty Git repository or reinitialize an existing one",
            "takes_value":true
          
        },
        {
            "arg":"--add",
            "short":"-a",
            "required":false,
            "about":"Add file contents to the index",
            "takes_value":true
        },
        {
            "arg":"--commit",
            "short":"-c",
            "required":false,
            "about":"Record changes to the repository",
            "takes_value":true,
            "subcommands":[
                {
                    "arg":"--message",
                    "short":"-m",
                    "required":false,
                    "about":"commit message",
                    "takes_value":true
                },
                {
                    "arg":"--file",
                    "short":"-F",
                    "required":false,
                    "about":"read message from file",
                    "takes_value":true
                }
            ]
        }, 
        {
            "arg":"--push",
            "short":"-p",
            "required":false,
            "about":"Update remote refs along with associated objects",
            "takes_value":true
        },  
        {
            "arg":"--pull",
            "short":"  ",
            "required":false,
            "about":"Update remote refs along with associated objects",
            "takes_value":true
        },
        {
            "arg":"status",
            "short":"-s",
            "required":false,
            "about":"Show the working tree status",
            "takes_value":true
        }
    ]
}
cargo add cok

main.rs

#[allow(warnings)]
fn main() {
    use cok::cli::Cli;
    let json = include_str!("../cli.json");
    let cli = Cli::new()
    .load_from_json(json);
    let args = Cli::args();   
}

a simple cli

git 0.1.1
Anonymous <dnrops@anonymous.com>
A git cli

USAGE:
git     -i --init       not_required    takes_value             Create an empty Git repository or reinitialize an existing one
git     -a --add        not_required    takes_value             Add file contents to the index
git     -c --commit     not_required    takes_value             Record changes to the repository
git     -p --push       not_required    takes_value             Update remote refs along with associated objects
git        --pull       not_required    takes_value             Update remote refs along with associated objects
git     -s status       not_required    takes_value             Show the working tree status
git     -h --help                       Prints help information

SUBCOMMANDS:
git     -c --commit     -m --message    not_required    takes_value             commit message
git     -c --commit     -F --file       not_required    takes_value             read message from file