Crates.io | snap_cli |
lib.rs | snap_cli |
version | 2.0.2 |
source | src |
created_at | 2024-06-02 23:30:17.735764 |
updated_at | 2024-06-06 20:44:53.070075 |
description | A simple CLI library |
homepage | |
repository | https://github.com/DeveloperJosh/snap_cli |
max_upload_size | |
id | 1259545 |
size | 24,973 |
Need Help? Join the discord
Snap is a lightweight and efficient command-line argument handler, inspired by clap
.
Add this to your Cargo.toml
:
[dependencies]
snap = "2.0.2"
Usage Here's a simple example of how to use Snap:
use snap_cli::{app::App, arg::Arg, command::Command};
fn main() {
let matches = App::new("myapp")
.version("1.0")
.author("Your Name <your@email.com>")
.about("Does awesome things")
.arg("<input> 'Sets the input file to use'")
.arg("-v, --verbose 'Sets the level of verbosity'")
.get_matches();
if let Some(input) = matches.value_of("input") {
println!("Using input file: {}", input);
}
if matches.is_present("verbose") {
println!("Verbose mode is on");
}
}
More detailed examples can be found in the examples directory.
use snap_cli::{app::App, arg::Arg, command::Command};
fn main() {
let matches = App::new("myapp")
.version("1.0")
.author("Your Name <your@email.com>")
.about("Does awesome things")
.arg("<input> 'Sets the input file to use'")
.arg("-v, --verbose 'Sets the level of verbosity'")
.get_matches();
if let Some(input) = matches.value_of("input") {
println!("Using input file: {}", input);
}
if matches.is_present("verbose") {
println!("Verbose mode is on");
}
}
Contributions are welcome! Feel free to open issues or submit pull requests.
This project is licensed under the MIT License.