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

Update top level docs and docs of methods that configure into Options #103

Merged
merged 2 commits into from Jan 14, 2021

Conversation

zdenek-crha
Copy link
Contributor

The pull request contains two changes (in separate commits) for ticket #44 :

  1. Update wording of top level documentation to talk only about methods that add configuration options since creating components by hand is not supported in current code.

  2. Add examples for methods that add configuration options (except opt())

For the second change I have considered enhancing the top level example, but felt that it would become bloated and hard to read. Instead I've opted into adding short, basic setup & query examples to each method that adds option into parser configuration instance.

I have also submitted ticket #102 as side result of the implementation - using std::matches macro could make examples that showcase Fail enum shorter and easier to read. But I did not want to break backward compatibility (because I did not know what it is :-))

Feel free to review and critique.

Rewrite the usage introduction to mention only builder-like methods that
add option config when creating instance of Options struct. Passing
vector of components is not supported now and the working may cause
confusion.

Add mention of the double-dash '--' argument and how it works to the
overview of option handling
Provide example usage for methods that configure accepted options. The
examples describe how to do basic setup and how to query parsed Matches
instance for builder-like methods.

The only exception is the opt() method which provides too much freedom
of configuration to write short sensible example.
@KodrAus
Copy link
Contributor

KodrAus commented Jan 14, 2021

Thanks @zdenek-crha! This looks good to me.

@KodrAus KodrAus merged commit 6e5c619 into rust-lang:master Jan 14, 2021
@zdenek-crha zdenek-crha deleted the better_usage_examples branch January 14, 2021 06:23
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.

None yet

2 participants