moved user help functions to a new module, added flag help for rainbow and trans flags

This commit is contained in:
Valerie Wolfe 2023-07-02 11:28:05 -04:00
parent 6488a40905
commit 4749f1a0aa
2 changed files with 83 additions and 45 deletions

77
src/help.rs Normal file
View file

@ -0,0 +1,77 @@
use crate::VERSION;
pub fn help_text() {
println!("pride v{VERSION}
Valerie Wolfe <sleeplessval@gmail.com>
Display pride flags in the terminal.
usage: pride [flags] [name]
args:
<name> The pride flag to display
flags:
-h, --help Shows this help text
--version Show version information
-l, --list Prints a list of printable flags
-s, --small Prints a small version without holding
Use 'pride --list' to see a list of printable flags
~ You're loved and you matter ");
}
pub fn list_text() {
println!("pride v{VERSION}
flag list:
agender agender pride flag
aro, aromantic aromantic pride flag
ace, asexual asexual pride flag
bigender bigender pride flag
bi, bisexual bisexual pride flag
gay, mlm gay men pride flag
genderfluid genderfluid pride flag
gender-nonconforming gender nonconforming pride flag
genderqueer genderqueer pride flag
gendervoid gendervoid pride flag
lesbian lesbian pride flag
multigender multigender pride flag
nb, nonbinary nonbinary pride flag
pan, pansexual pansexual pride flag
pride, rainbow six-color rainbow flag
trans, transgender transgender pride flag");
}
pub fn flag_help(flag: &str) {
match flag {
"pride" | "rainbow"
=> {
println!("The ubiquitous 1979 6-color rainbow pride flag, representing the larger queer community.
names:
'pride', 'rainbow'
variants:
8-color Gilbert Baker's original 1978 flag with 8 stripes
gilbert-baker
sex-and-magic
philadelphia The 2017 Philadelphia Pride flag with black and brown stripes");
},
"transgender" | "trans"
=> {
println!("The transgender pride flag designed by Monica Helms in 1999.
names:
'transgender', 'trans'
");
}
_
=> help_text()
}
}

View file

@ -5,6 +5,7 @@ use pico_args::Arguments;
mod color;
mod draw;
mod flag;
mod help;
mod variant;
use crate::color::Colors;
@ -17,13 +18,15 @@ fn main() {
// handle help flag
if args.contains(["-h", "--help"]) {
help_text();
let target = args.subcommand().unwrap();
if target.is_some() { help::flag_help(&target.unwrap()); }
else { help::help_text(); }
return;
}
// handle list flag
if args.contains(["-l", "--list"]) {
list_text();
help::list_text();
return;
}
@ -100,7 +103,7 @@ fn main() {
Some("pansexual" | "pan")
=> flag::pansexual(),
_ => { help_text(); exit(1) } // (or die)
_ => { help::help_text(); exit(1) } // (or die)
};
if small { draw::small(colors); }
@ -108,45 +111,3 @@ fn main() {
}
fn help_text() {
println!("pride v{VERSION}");
println!("Valerie Wolfe <sleeplessval@gmail.com>");
println!("Show pride flags in the terminal.\n");
println!("usage: pride [flags] [name]\n");
println!("args:");
println!(" <name> The pride flag to display\n");
println!("flags:");
println!(" -h, --help Shows this help text");
println!(" --version Show version information");
println!(" -l, --list Prints a list of printable flags");
println!(" -s, --small Prints a small version without holding");
println!("\nUse 'pride --list' to see a list of printable flags");
println!("\n~ You're loved and you matter ♥");
}
fn list_text() {
println!("pride v{}", env!("CARGO_PKG_VERSION"));
println!("\nFlag list:");
println!(" agender agender pride flag");
println!(" aro, aromantic aromantic pride flag");
println!(" ace, asexual asexual pride flag");
println!(" bigender bigender pride flag");
println!(" bi, bisexual bisexual pride flag");
println!(" gay, mlm gay men pride flag");
println!(" genderfluid genderfluid pride flag");
println!(" gender-nonconforming gender nonconforming pride flag");
println!(" genderqueer genderqueer pride flag");
println!(" gendervoid gendervoid pride flag");
println!(" lesbian lesbian pride flag");
println!(" multigender multigender pride flag");
println!(" nb, nonbinary nonbinary pride flag");
println!(" pan, pansexual pansexual pride flag");
println!(" pride, rainbow six-color rainbow flag");
// println!(" progress progress arrow flag");
println!(" trans, transgender transgender pride flag");
}