Crates.io | args_flags_1 |
lib.rs | args_flags_1 |
version | 0.2.0 |
source | src |
created_at | 2022-11-25 23:26:17.207715 |
updated_at | 2023-01-08 15:36:05.897152 |
description | A library for manipulating with flags |
homepage | |
repository | |
max_upload_size | |
id | 723005 |
size | 8,110 |
This project is trying to simplify the process of making CLI program. it will detect flag for your program and give you ways to have access to list of Flag the program is receiving.
imports:
use args_flags_1::{FlagDetect, StaticFlagOnly, StaticFlag, Flag};
let flags: Vec<Flag> = StaticFlag::get("-", std::env::args());
let flags: Vec<Flag> = StaticFlag::getn(vec!["--", "-"], std::env::args());
let prefix: &str = "-";
let flags: Vec<String> = StaticFlag::get(prefix, std::env::args());
let flags: Vec<String> = StaticFlag::getn(vec![prefix], std::env::args());
let prefix: &str = "-";
let flags: Vec<Flag> = StaticFlag::get(prefix, std::env::args());
let flags: Vec<Flag> = StaticFlag::getn(vec![prefix], std::env::args());
let prefix: &str = "-";
let args: std::env::Args = std::env::args();
let detect: FlagDetect = FlagDetect::new(prefix).from_args(args);
// gives back value of the flag
let s_flag: Option<String> = detect.find("-s");
match s_flag {
Some(x) => {},
None => {}
}