Skip to content

Conversation

@boiledfroginthewell
Copy link

fixes: #1843

Comment on lines +66 to 67
'(operation)*: :__task_list' \
+ '(operation)' \

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.)

Comment on lines -62 to +72
'(-*)'{-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]' \
Copy link
Author

@boiledfroginthewell boiledfroginthewell Sep 29, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

- (-*)--version
+ (- *)--version

I 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.)

@vmaerten vmaerten requested a review from Copilot November 23, 2025 14:26
Copilot finished reviewing on behalf of vmaerten November 23, 2025 14:29
Copy link

Copilot AI left a 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 _arguments configuration with -S flag 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.

@vmaerten
Copy link
Member

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?

@vmaerten vmaerten self-requested a review November 29, 2025 14:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fish/zsh shell completions suggest task names even for CLI_ARGS

2 participants