Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The default
flags
package for go has fairly poor documentation regarding how to do short and long forms of flags. The simplest way to do this appears to be to define separate flags that write to the same pointer, and then override the help text so that they get shown together.This PR currently defines:
-f
for--follow
-l
for--lang
-F
for--quit-if-one-screen
-w
for--wrap
-V
for--version
-h
for--help
is automatically checked by the upstream package, but neither form was listed in the default help textThe overridden help text I made prints each flag, including
-h
/--help
, on a single line, with short flags, long flags, and descriptions each being column-aligned. It also uses double-dashes for long flags, and while the ability to use single-dashes is needed for short-flag support, the default help text only using single-dashes was very confusing, at least to me.Due to how the default
flags
package works, while the custom help text only shows single-dashes for short flags and double-dashes for long flags, the other way around will still be parsed and accepted. This comes with the perhaps surprising quirk that multiple short flags need to be separated by spaces, rather than being accepted as compound flags that all share a single-dash.Being new to this project, I am uncertain regarding style choices and am willing to modify the way things are written to better fit the established code (for example: changing the help text from a large constant string into a sequence of
fmt.Println
statements). I am also willing to change the format of the help text if desired.Resolves #98