Compare commits

..

3 commits

3 changed files with 15 additions and 2 deletions

View file

@ -20,7 +20,7 @@ path = "src/main.rs"
[dependencies]
pico-args = "0.5.0"
termion = "3.0.0"
termion = "4.0.3"
[profile.release]
opt-level = 's'

View file

@ -82,6 +82,13 @@ The rainbow flag designed for 2017 Philadelphia Pride.
.It Ic transgender, trans
The transgender pride flag designed by Monica Helms in 1999.
.El
.Sh ENVIRONMENT
.Bl -tag -width Ds
.It PRIDE_DEFAULT
A string containing the name of a flag to use as the default when no
.Ar flag
argument is provided.
.El
.Sh EXIT STATUS
.Bl -tag -width Ds
.It 1

View file

@ -1,4 +1,5 @@
//! main method module
use std::env::var;
use pico_args::Arguments;
@ -50,7 +51,12 @@ fn main() {
let state = State::new(&mut args);
let subcommand = args.subcommand().unwrap();
let subcommand =
if let Ok(Some(subcommand)) = args.subcommand() { Some(subcommand) }
else if let Ok(default) = var("PRIDE_DEFAULT") {
if default.is_empty() { None }
else { Some(default) }
} else { None };
let variant = args.subcommand().unwrap();
// get color vec from matched flag