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

Use getopt style short/long argument flags (without using getopt package) #34

Merged
merged 1 commit into from
Jan 10, 2024

Conversation

wader
Copy link
Owner

@wader wader commented Jan 9, 2024

Alternative to #30 without using getopt package. One difference is that multiple short flags can't be combined ex: -ab instead of -a -b does not work.

@wader
Copy link
Owner Author

wader commented Jan 9, 2024

@patrislav1 less code but works a little bit differently for short flags

@patrislav1
Copy link
Collaborator

don't have a strong opinion, I mean being able to combine flags is nice but it's not crucial and most of the flags require arguments anyway

--help, -h Show help
--listcolorschemes List color schemes
--transparent Transparent background
--width, -w Terminal width (auto if not set)
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I shorted some texts to stay within 80 characters. Otherwise help text look good? should include something more?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

program | %[1]s > file.svg

`[1:], fs.Name())
fs.VisitAll(func(f *flag.Flag) {
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should maybe comment that is a ugly hack to skip the short flags

@wader
Copy link
Owner Author

wader commented Jan 10, 2024

don't have a strong opinion, I mean being able to combine flags is nice but it's not crucial and most of the flags require arguments anyway

Mm same :) i usually try to be conservative about not using standard library.

But i should probably add some short flag tests at least... and at the same time maybe change the test to use .stdout?

BTW if you want i can add you as a collaborator so you can do more things yourself, i trust your judgement :)

@patrislav1
Copy link
Collaborator

BTW if you want i can add you as a collaborator so you can do more things yourself, i trust your judgement :)

Thank you 😄 Yes it would make sense then I guess.

@wader wader merged commit 39b9039 into master Jan 10, 2024
1 check passed
@wader wader deleted the flag-short-long branch January 10, 2024 19:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants