Gelio / go-global-update

A command to update globally installed go executables
MIT License
146 stars 4 forks source link

Add CLI short option alternatives #16

Closed Gelio closed 2 years ago

Gelio commented 2 years ago

Add shorter aliases for the existing options:

-v was previously used as an alias for --version. A shorter alias for --version is now -V. This could be a breaking change and is described in the CHANGELOG as such.

This matches the flags accepted by some POSIX tools.

Sadly, https://github.com/urfave/cli does not seem to be supporting providing multiple short options in a single argument prefixed by -:

16:42 $ go run main.go -nv
Incorrect Usage. flag provided but not defined: -nv

Providing those 2 flags as separate arguments works fine:

16:42 $ go run main.go -n -v
Binary                                        Current version      Status
github.com/Gelio/go-global-update             v0.2.0               up-to-date
mvdan.cc/gofumpt                              v0.3.1               up-to-date
github.com/xxxserxxx/gotop/v4/cmd/gotop       v4.1.2               can upgrade to v4.1.3
github.com/client9/misspell/cmd/misspell      v0.3.4               up-to-date
mvdan.cc/sh/v3/cmd/shfmt                      v3.4.3               up-to-date

I have also fixed the --help output for the --colors flag. Before, the NO_COLOR text was placed right after the --colors flag, which looked like --colors NO_COLOR and resembled that NO_COLOR is a value for the --colors flag. In reality, they are opposites of each other and should be used separately.

Closes #15