revise 'Options' documentation #3192
Open
+34
−38
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.
#3175
If #3191 is approved I'd be happy to go back and handle any merge conflicts caused by this PR's changes.
Clarity improvements
The "Option Decorator" section refers to "positional arguments" of the
click.option()decorator and to the "function argument" of the decorated callback function. Using "positional arguments" as shorthand for "positional arguments passed to theoption()decorator" introduces ambiguity, because the decorated function can also accept positional arguments (and in fact does in every provided example). Using "function" as shorthand for "decorated function" is also ambiguous. References to the positional arguments forclick.option()are changed to "parameter declarations" (for consistency with the API docs), and "function argument" is replaced with the more specific "callback argument".When describing the steps to infer the callback argument name from the parameter declarations, the following is misleading (possibly outdated?):
The actual criteria is that the argument is a valid identifier, i.e.
str.isidentifier()returnsTrue(seeOption._parse_decls()). A string that is "prefixed" with_would therefore be chosen. The step is updated to reflect this and links to Python's "Lexical analysis" documentation.Several sections use "pass in" back-to-back when referencing
option()arguments and command line usage. This makes it unclear when the command line usage is being referenced. When referring tooption(), instead use "declare" for positional arguments or "set" for keyword arguments.Consistency improvements
All instances of "underlying function" are replaced with "decorated function".
References to "dash(es)" are replaced with
-or--. This establishes consistency with the "Other Prefix Characters" section and allows for several sentences to be reworded for concision.Miscellaneous
Minor grammar and concision edits throughout.