Skip to content

Add extra::getopts::short_usage #12001

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

Merged
merged 1 commit into from
Feb 6, 2014
Merged

Conversation

yuriks
Copy link
Contributor

@yuriks yuriks commented Feb 2, 2014

This complements usage by auto-generating a short one-liner summary
of the options.

(First timer here, be gentle... :)

This complements `usage` by auto-generating a short one-liner summary
of the options.
@brson
Copy link
Contributor

brson commented Feb 3, 2014

Interesting patch. Thanks! Is there anywhere in our codebase we should be using this?

@yuriks
Copy link
Contributor Author

yuriks commented Feb 3, 2014

I based this on the format output by python's argparse library. It's not adequate for programs with lots of options (like rustc) which is why I left it as a separate function instead of integrating it with the main usage function, so that its use would be left to the user's discretion. If an additional tag were added to options to mark them as "less important" and only display them in the list help, abbreviating them under [options..] in the usage summary, that could be make to work for more complex interfaces also.

Today I've started writing a more complete argument parsing library, which will handle more combinations of options, as well as positional arguments (which need to be handled completely adhoc with getopts), and hopefully will be a good replacement for getopts, especially since it's being split from extra. For this reason I'll refrain from any extensive additions to getopts at this time. I'd appreciate if people could comment with things they'd wish to see on such a library.

bors added a commit that referenced this pull request Feb 6, 2014
This complements `usage` by auto-generating a short one-liner summary
of the options.

(First timer here, be gentle... :)
bors added a commit that referenced this pull request Feb 6, 2014
This complements `usage` by auto-generating a short one-liner summary
of the options.

(First timer here, be gentle... :)
@bors bors closed this Feb 6, 2014
@bors bors merged commit 65a6c7c into rust-lang:master Feb 6, 2014
@yuriks yuriks deleted the getopts-tweaks branch February 6, 2014 17:40
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.

4 participants