# A simple to use, efficient, Command Line Argument Parser
[](https://crates.io/crates/cok)
[](https://gitlab.com/andrew_ryan/cok)
[](https://gitlab.com/andrew_ryan/cok/-/raw/master/LICENSE)
## Example
create cli.json
```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
```rust
#[allow(warnings)]
fn main() {
use cok::cli::Cli;
Cli::load_from_json("./cli.json");
let args = Cli::args();
}
```
a simple cli
```
git 0.1.1
Anonymous <dnrops@anonymous.com>
A git cli
USAGE:
OPTION REQUIRED ABOUT
git -i --init false Create an empty Git repository or reinitialize an existing one
git -a --add false Add file contents to the index
git -c --commit false Record changes to the repository
git -p --push false Update remote refs along with associated objects
git --pull false Update remote refs along with associated objects
git -s status false Show the working tree status
git -h --help Prints help information
SUBCOMMANDS:
OPTION SUBCOMMAND REQUIRED ABOUT
git -c --commit -m --message false commit message
git -c --commit -F --file false read message from file
```