diff --git a/Cargo.toml b/Cargo.toml index a3d1968..7775c2f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pride" -version = "1.0.0" +version = "0.4.1" edition = "2021" authors = [ "Valerie Wolfe " ] description = "Pride flags in the terminal." diff --git a/man/pride.6 b/man/pride.6 index 84d763f..5483698 100644 --- a/man/pride.6 +++ b/man/pride.6 @@ -7,7 +7,7 @@ .Sh SYNOPSIS .Nm .Op Fl hlv -.Op Fl s Ar size +.Op Fl s Op Ar size .Op Ar flag .Sh DESCRIPTION .Nm @@ -18,8 +18,8 @@ displays pride flags in the terminal using ANSI truecolor sequences. Shows a brief help text. .It Fl l , Fl -list Shows a list of available pride flags. -.It Fl s , Fl -size Ar size -Scales the flag to the given size: 'small' will produce the minimum size; one number sets the width; and two numbers separated by 'x' sets width and height respectively. +.It Fl s , Fl -size Op Ar size +Scales the flag to the given size: no value or 'small' will produce the minimum size; one number sets the width; and two numbers separated by 'x' sets width and height respectively. .It Fl v , Fl -version Shows version information. .It Ar flag diff --git a/src/help.rs b/src/help.rs index 52f010a..8edc574 100644 --- a/src/help.rs +++ b/src/help.rs @@ -19,7 +19,7 @@ flags: -h, --help Shows this help text --version Show version information -l, --list Prints a list of printable flags - -s, --size Sets the size of the output flag. + -s, --size [size] Sets the size of the output flag. Use 'pride --list' to see a list of printable flags diff --git a/src/state.rs b/src/state.rs index 0950b4c..9d58130 100644 --- a/src/state.rs +++ b/src/state.rs @@ -50,10 +50,14 @@ impl State { let is_terminal = stdout().is_terminal(); let size = match args.value_from_str::<[&str;2], String>(FLAG_SIZE).as_deref() { - Ok(value) => Size::from(value), - Err(Error::MissingOption(_)) | - Err(Error::MissingArgument) => if is_terminal { Size::Full } else { Size::Small }, - _ => { error::size_missing(); panic!() } + Ok(value) => Size::from(value), + + Err(Error::MissingOption(_)) | + Err(Error::MissingArgument) => if is_terminal { Size::Full } else { Size::Small }, + + Err(Error::OptionWithoutAValue(_)) => Size::Small, + + _ => { error::size_missing(); panic!() } }; State { size, is_terminal }