Skip to content

Conversation

@WinkelCode
Copy link
Contributor

@WinkelCode WinkelCode commented Dec 19, 2025

Non-POSIX compliant whitespace \s ( https://superuser.com/a/112837 ) causes broken task name tab-completion #2591 on macOS.

Replacing \s with [[:space:]] appears to fix the issue:

sed -e '1d; s/\* \(.*\):\s\{2,\}\(.*\)\s\{2,\}(\(aliases.*\))/\1\t\2\t\3/' -e 's/\* \(.*\):\s\{2,\}\(.*\)/\1\t\2/'

into

sed -e '1d; s/\* \(.*\):[[:space:]]\{2,\}\(.*\)[[:space:]]\{2,\}(\(aliases.*\))/\1\t\2\t\3/' -e 's/\* \(.*\):[[:space:]]\{2,\}\(.*\)/\1\t\2/'

Copilot AI review requested due to automatic review settings December 19, 2025 04:05
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 a macOS compatibility issue in the Fish shell completion script by replacing non-POSIX compliant \s whitespace patterns with POSIX-compliant [[:space:]] in sed regex. This addresses broken tab-completion for task names on macOS where BSD sed doesn't support \s.

  • Replaces \s with [[:space:]] in two sed regex expressions
  • Ensures POSIX compliance for better cross-platform compatibility

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@WinkelCode WinkelCode marked this pull request as draft December 19, 2025 04:10
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

Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@WinkelCode
Copy link
Contributor Author

WinkelCode commented Dec 19, 2025

Finally, this is what works "on my machine" (gotta remember to actually save the file before commiting 🙄 ).

There may be more "elegant" ways to do it, but a quick way to test this is opening up /opt/homebrew/Cellar/go-task/*/share/fish/vendor_completions.d/task.fish and changing its content with the PR. Remember to close and reopen the shell after making changes.

I should note that the use of \s in the first expression didn't seem to cause any issues with tab-completion in the Taskfiles I had on hand, even those with task aliases (and completing using those aliases).

Edit:

I want to be clear that, while I use it regularly, I am by no means a regex expert, especially not on the topic of portability of expressions between different versions of programs like sed.

@WinkelCode WinkelCode marked this pull request as ready for review December 19, 2025 04:39
@vmaerten vmaerten self-requested a review December 24, 2025 14:24
@vmaerten vmaerten added the area: completions Changes related to shell completions and scripts. label Dec 24, 2025
@vmaerten
Copy link
Member

Thanks for the PR!
It seems to be working on Linux. I’m just waiting for someone to confirm it on macOS; after that, it should be fine.
I won’t republish a package for this. You will be able to use the nightly build completion as a workaround.

Copy link
Member

@andreynering andreynering left a comment

Choose a reason for hiding this comment

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

Thank you @WinkelCode!

@andreynering andreynering merged commit 0653886 into go-task:main Dec 24, 2025
13 checks passed
andreynering added a commit that referenced this pull request Dec 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: completions Changes related to shell completions and scripts.

Projects

None yet

3 participants