Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ feature request ] provide short options to long options #98

Open
nkh opened this issue Jul 21, 2022 · 2 comments · May be fixed by #267
Open

[ feature request ] provide short options to long options #98

nkh opened this issue Jul 21, 2022 · 2 comments · May be fixed by #267

Comments

@nkh
Copy link

nkh commented Jul 21, 2022

triple thumbs up for long options but for us who use moar (or any other program) in bash scripts putting three long (no status bar, continuation glyph, continuation glyph color) options means an extra line or worse an extra variable to hold the options.

screenshot_2022-07-21_19-49-41

@walles
Copy link
Owner

walles commented Jul 22, 2022

I agree in principle, and I vaguely recall looking into alternatives to Go's standard library flag handling (which is what I'm using now) for this very reason.

As I recall:

  • The alternatives I found didn't come with enum support, (think --statusbar={inverse|plain|bold})
  • I felt that the alternatives I found were wonky to switch to

So I gave up. While not great, I think the current options handling works well enough.

What all this means is that:

  • I'm not interested in spending any more time on this myself
  • I am willing to accept PRs if somebody else does the work

Thus, labeling this as help-wanted.

@boomshroom
Copy link

I found this blog post regarding flags in Go: Short and Long Options with Go flag standard package. While the lack of short flags is annoying, the fact that the help screen showed that all flags have single dashes was very confusing since they're usually only used on short flags.

Turns out these two things are related, and single dashes are accepted precisely because they emulate the behavior or short flags, meaning the way to handle short and long flags with the standard library is to define separate flags that share a pointer where one is short and the other is long. This allows for using double dashes on short flags and single dashes on long flags, and the way to deal with this is just to give a custom usage screen that only shows single dashes with short flags and double dashes with long flags.

@boomshroom boomshroom linked a pull request Feb 14, 2025 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants