added the PRIDE_DEFAULT env var to set the default flag

This commit is contained in:
Valerie Wolfe 2024-11-20 16:10:29 -05:00
parent 9bac43bf5d
commit 90e5eb8f79
2 changed files with 9 additions and 1 deletions

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,7 @@ 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 { var("PRIDE_DEFAULT").ok() };
let variant = args.subcommand().unwrap();
// get color vec from matched flag