Crates.io | cok |
lib.rs | cok |
version | 0.1.13 |
source | src |
created_at | 2022-10-09 00:52:01.488885 |
updated_at | 2023-09-09 14:48:22.619697 |
description | A simple to use, efficient, Command Line Argument Parser |
homepage | |
repository | https://gitlab.com/andrew_ryan/cok |
max_upload_size | |
id | 683812 |
size | 16,214 |
create cli.json
{
"name":"cargo",
"version":"1.0.0",
"authors":["andrew <dnrops@anonymous.com>","ryan <rysn@gmail.com>"],
"description":"Rust's package manager",
"options":[
{
"name":"--version",
"short":"V",
"description":"Print version info and exit"
},
{
"name":"--offline",
"description":"Run without accessing the network"
}
],
"commands":[
{
"name":"build",
"short":"b",
"description":"Compile the current package"
},
{
"name":"check",
"short":"c",
"description":"Analyze the current package and report errors, but don't build object files"
},
{
"name":"clean",
"description":"Remove the target directory"
},
{
"name":"new",
"description":"Create a new cargo package"
},
{
"name":"add",
"description":"Add dependencies to a manifest file"
}
]
}
cargo add cok
main.rs
fn main() {
use cok::Cli;
let json = include_str!("../cli.json");
let cli = Cli::new(json);
let args = cli.args();
if args.len() !=3{
cli.print_help()
}
}
a simple cli
cargo 1.0.0
andrew <dnrops@anonymous.com>,ryan <rysn@gmail.com>
Rust's package manager
Usage: cargo [OPTIONS] [COMMAND]
Options:
cargo build, b Compile the current package
cargo check, c Analyze the current package and report errors, but don't build object files
cargo clean Remove the target directory
cargo new Create a new cargo package
cargo add Add dependencies to a manifest file
Commands:
cargo build, b Compile the current package
cargo check, c Analyze the current package and report errors, but don't build object files
cargo clean Remove the target directory
cargo new Create a new cargo package
cargo add Add dependencies to a manifest file
cargo -h --help Prints help information