-
Notifications
You must be signed in to change notification settings - Fork 4
Hide flag completion unless input ends with a hyphen #35
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
Conversation
| def patterns! | ||
| config.map do |text, completions| | ||
| Pattern.new text, completions | ||
| Pattern.new text, completions, pattern_function_name |
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.
Pattern now receives a function name, which is the name of the helper filter function. It is used in Pattern#compgen to generate the compgen string which now calls a function rather than just using the string straight up.
| fi | ||
| } | ||
|
|
||
| <%= function_name %>() { |
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.
The function at line 7 receives a space-delimited string of possible completions, and:
- returns the same string if the current word starts with a hyphen
- returns a new string without any
--flagsif the current word does not start with a hyphen
| @@ -1,24 +1,32 @@ | |||
| ftp: | |||
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.
Since completions are now returned differently if the input ends with a hyphen, this integration spec config was expanded to list both cases.
mrliptontea
left a comment
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 think this works, nice.
|
Merged, will release later. |
This change makes it so the returned completions will not include any flags (
--flags) unless the input line ends with a-.In other words, given this config:
The new behavior will be:
instead of:
cc #32