-
-
Notifications
You must be signed in to change notification settings - Fork 763
fix: CLI_ARGS completion for fish and zsh (#1843) #1844
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
base: main
Are you sure you want to change the base?
fix: CLI_ARGS completion for fish and zsh (#1843) #1844
Conversation
| '(operation)*: :__task_list' \ | ||
| + '(operation)' \ |
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.
Task-name completions didn't work except for the first positional argument in zsh, but this has been fixed as well.
(Argument specifications after + '(operation)' become mutually exclusive options. In the previous code, *: :__task_list also prevented other task names from being suggested when one task name is specified in a command line.)
| '(-*)'{-h,--help}'[show help]' \ | ||
| '(-*)--version[show version and exit]' \ | ||
| '*: :__task_list' | ||
| '(*)'{-l,--list}'[list describable tasks]' \ | ||
| '(*)'{-a,--list-all}'[list all tasks]' \ | ||
| '(*)'{-i,--init}'[create new Taskfile.yml]' \ | ||
| '(- *)'{-h,--help}'[show help]' \ | ||
| '(- *)--version[show version and exit]' \ |
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.
- (-*)--version
+ (- *)--versionI suppose (- *) is the intended one. This prevents all options and positional arguments from being suggested when the --version option is supplied.
(The parentheses specify groups of arguments to prevent suggestions. - and * are special group names for options and rest positional arguments, respectively. I think the -* group is not defined here.)
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.
Pull request overview
This PR fixes shell completion behavior for fish and zsh to properly handle CLI_ARGS passed after the -- separator. The fix aligns fish and zsh completion behavior with the existing bash completion, ensuring that task names are not suggested after --, allowing for proper file and default completion of CLI arguments instead.
Key changes:
- Added
--separator detection in zsh completion to trigger default completion for CLI_ARGS - Modified zsh
_argumentsconfiguration with-Sflag and improved exclusion patterns - Updated fish completion to prevent task name suggestions after
--separator
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| completion/zsh/_task | Added -- detection logic to call _default completion after separator; added -S flag to _arguments; reorganized option specifications with proper exclusion patterns |
| completion/fish/task.fish | Added condition to prevent task completion after -- separator using __fish_seen_subcommand_from |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Thanks for the PR! I know I'm more than a year late, but would you be willing to rebase and resolve the conflicts, @boiledfroginthewell? |
fixes: #1843