Compare commits

..

2 commits

Author SHA1 Message Date
3e86e4f053 added missing type annotation 2023-06-19 20:52:22 -04:00
de5aa01daf added version flag 2023-06-19 20:51:45 -04:00
2 changed files with 17 additions and 7 deletions

View file

@ -1,6 +1,6 @@
[package] [package]
name = "pride" name = "pride"
version = "0.1.1" version = "0.1.2"
edition = "2021" edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

View file

@ -8,21 +8,30 @@ mod flag;
use crate::color::Colors; use crate::color::Colors;
static VERSION: &str = env!("CARGO_PKG_VERSION");
fn main() { fn main() {
let mut args = Arguments::from_env(); let mut args = Arguments::from_env();
let help = args.contains(["-h", "--help"]); // handle help flag
if help { if args.contains(["-h", "--help"]) {
help_text(); help_text();
return; return;
} }
let list = args.contains(["-l", "--list"]); // handle list flag
if list { if args.contains(["-l", "--list"]) {
list_text(); list_text();
return; return;
} }
// handle version flag
if args.contains("--version") {
println!("pride v{VERSION}");
return;
}
// get small flag
let small = args.contains(["-s", "--small"]); let small = args.contains(["-s", "--small"]);
let subcommand = args.subcommand().unwrap(); let subcommand = args.subcommand().unwrap();
@ -80,7 +89,7 @@ fn main() {
} }
fn help_text() { fn help_text() {
println!("pride v{}", env!("CARGO_PKG_VERSION")); println!("pride v{VERSION}");
println!("Valerie Wolfe <sleeplessval@gmail.com>"); println!("Valerie Wolfe <sleeplessval@gmail.com>");
println!("Show pride flags in the terminal.\n"); println!("Show pride flags in the terminal.\n");
@ -91,6 +100,7 @@ fn help_text() {
println!("flags:"); println!("flags:");
println!(" -h, --help Shows this help text"); println!(" -h, --help Shows this help text");
println!(" --version Show version information");
println!(" -l, --list Prints a list of printable flags"); println!(" -l, --list Prints a list of printable flags");
println!(" -s, --small Prints a small version without holding"); println!(" -s, --small Prints a small version without holding");