-
-
Notifications
You must be signed in to change notification settings - Fork 624
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
fix(completion): display aliases in fish completion #1782
Conversation
I have the same result as you and it looks good to me! I was surprised the completion was displayed like this, but it works like expected 😇 PS: I hope those completions will, one day, be part of the product and not volatile scripts maintained aside from the source code. |
Interesting 🤔 with this file:
The completion choose wdyt? |
@@ -10,7 +10,7 @@ function __task_get_tasks --description "Prints all available tasks with their d | |||
end | |||
|
|||
# Grab names and descriptions (if any) of the tasks | |||
set -l output (echo $rawOutput | sed -e '1d; s/\* \(.*\):\s*\(.*\)\s*(aliases.*/\1\t\2/' -e 's/\* \(.*\):\s*\(.*\)/\1\t\2/'| string split0) | |||
set -l output (echo $rawOutput | sed -e '1d; s/\* \(.*\):\s*\(.*\)\s*(\(aliases.*\))/\1\t\2\t\3/' -e 's/\* \(.*\):\s*\(.*\)/\1\t\2/'| string split0) |
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.
Happy with this as a fix, but I think it would be good to move this complexity to Task itself sometime rather than relying on invoking sed
. Looking at this expression gives me a headache 😆
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.
Definitive +1!
It would be simpler and more powerful. To match my previous comment, I had to do something like this:
set -l output (echo $rawOutput | sed -e '1d; s/\* \(.*\):\s*\(.*\)\s*(aliases: \(.*\))/\1,\3/' -e 's/\* \(.*\):\s*\(.*\)/\1\t\2/' -e 's@,@\n@g' -e 's@ @@g'| string split0)
The result is better than the original version, but doing that with a real language is the best solution/idea!
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 totally agree with you, I would even argue that fish / bash / zsh does not support the same "feature" in the auto complete
As you said, we could move all complexity in our go code
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've tested it in zsh, the behavior is the same, aliases are displayed but not "searchable"
For the record. I just merged #1157 which is the first step towards this. We can now start the process of generating the scripts instead of using the templates. |
@pd93 What do you think about merging this to have the same behavior as zsh, and, in the meantime, working on generating the scripts in golang ? |
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.
What do you think about merging this to have the same behavior as zsh, and, in the meantime, working on generating the scripts in golang ?
@vmaerten Yeah I'm fine with this. This change is still an improvement, even if there are still bigger changes to come.
Fixes #1781
Before :
After :
@davinkevin It would be amazing if you could test it before we release this. I test it locally with the docker container it sounds fine