-
Notifications
You must be signed in to change notification settings - Fork 392
Complete stdin "-" in file locations, add more options that allow it #1237
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
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No strong opinions, but I suppose we could simplify/optimize this to the following unless we see downsides to doing that? WDYT, and @akinomyoga too?
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, although it is functionally equivalent, I prefer using
_comp_compgen
which is more idiomatic.It takes time for me to understand that
[[ $cur == @?(-) ]] && COMPREPLY+=(-)
is functionally equivalent to_comp_compgen -ac "${cur:1}" -- -W '-'
and doesn't have a bug nor an extra intentional effect.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There seem to be both types of existing cases:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For me it's the opposite, I'm far from being "natural" with the stuff we've added over the few last releases and have to look up stuff a lot, almost certainly because I haven't been writing all that much code in this project lately, whereas straight bash is much easier for me. But I'm fine with those who are doing most of the actual work these days getting to decide the flavor. Would not hurt to be consistent with it though through the whole tree.
Pre-approved either way you guys decide.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't really mind either, I think the second option is easier to read without context, but the first one makes more sense here since it follows the same pattern as the line before it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I again thought about it, but I think it is still better to generate completions through
_comp_compgen
even in simple cases because it would be easier to apply changes later in a consistent way (by modifying the behavior of_comp_compgen
or by grep'ping the calls of_comp_compgen
).