Allow equals as long flag option-value separator#39
Merged
Conversation
I'm not sure I like this. It complicates the shell completion harness, and I'm not even sure a user will ever use --option=v<tab>
This reverts commit 64d3804.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This PR allows shifu to parse long option values that are separated from the option flag by an equals, e.g.
--option=value. There were a number of gotchas in this one mostly pertaining to how the feature integrates with current and potential tab completion. In particular, while I figured out a way to get--option=v<tab>to complete similarly to how--option v<tab>would, it required the shell specific tab completion harnesses to get more complicated and become aware they were completing a--option=pattern.I wasn't a fan of this complication, and further, while I tested the feature I realized that a user tab completing would be much less likely to use this feature because
--opt<tab>completes to--option; notice the space at the end there. Moreover, my original motivation to support--option=valuepattern parsing because it removed ambiguity when reading invocations likecli --option value. In this situation just reading the call you're not sure if--optionis a binary option andvalueis a positional/remaining arg or ifvalueis associated with--optionbecause it's a default or required option.Given these two realizations, I ripped the completion machinery out but left the parsing machinery.
This PR also make required variables in help strings no longer surrounded by brackets, and found+fixed a bug where the recent changes to parameterized test running was leaking state between cases causing some tests to fail unexpectedly.