made size flag change non-breaking and adjusted version

This commit is contained in:
Valerie Wolfe 2024-07-05 10:40:24 -04:00
parent 7cecac36ee
commit 0c1c1148c2
4 changed files with 13 additions and 9 deletions

View file

@ -1,6 +1,6 @@
[package] [package]
name = "pride" name = "pride"
version = "1.0.0" version = "0.4.1"
edition = "2021" edition = "2021"
authors = [ "Valerie Wolfe <sleeplessval@gmail.com>" ] authors = [ "Valerie Wolfe <sleeplessval@gmail.com>" ]
description = "Pride flags in the terminal." description = "Pride flags in the terminal."

View file

@ -7,7 +7,7 @@
.Sh SYNOPSIS .Sh SYNOPSIS
.Nm .Nm
.Op Fl hlv .Op Fl hlv
.Op Fl s Ar size .Op Fl s Op Ar size
.Op Ar flag .Op Ar flag
.Sh DESCRIPTION .Sh DESCRIPTION
.Nm .Nm
@ -18,8 +18,8 @@ displays pride flags in the terminal using ANSI truecolor sequences.
Shows a brief help text. Shows a brief help text.
.It Fl l , Fl -list .It Fl l , Fl -list
Shows a list of available pride flags. Shows a list of available pride flags.
.It Fl s , Fl -size Ar size .It Fl s , Fl -size Op 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. 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 .It Fl v , Fl -version
Shows version information. Shows version information.
.It Ar flag .It Ar flag

View file

@ -19,7 +19,7 @@ flags:
-h, --help Shows this help text -h, --help Shows this help text
--version Show version information --version Show version information
-l, --list Prints a list of printable flags -l, --list Prints a list of printable flags
-s, --size <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 Use 'pride --list' to see a list of printable flags

View file

@ -51,8 +51,12 @@ impl State {
let size = match args.value_from_str::<[&str;2], String>(FLAG_SIZE).as_deref() { let size = match args.value_from_str::<[&str;2], String>(FLAG_SIZE).as_deref() {
Ok(value) => Size::from(value), Ok(value) => Size::from(value),
Err(Error::MissingOption(_)) | Err(Error::MissingOption(_)) |
Err(Error::MissingArgument) => if is_terminal { Size::Full } else { Size::Small }, Err(Error::MissingArgument) => if is_terminal { Size::Full } else { Size::Small },
Err(Error::OptionWithoutAValue(_)) => Size::Small,
_ => { error::size_missing(); panic!() } _ => { error::size_missing(); panic!() }
}; };