Skip to content

Fish completion broken on macOS (BSD sed incompatibility) #2604

@max-sixty

Description

@max-sixty

Description

I think all fish completions are now broken on MacOS. Here's a reproducer, which Claude helped me write, and a link to the PR that I think created these changes.


What did you do?
Ran task <TAB> in fish shell on macOS to get task completions.

What did you expect to happen?

$ task <TAB>
clean  (Reset environment to declared dependencies.)

What happened instead?

$ task <TAB>
* clean:                         Reset environment to declared dependencies.  (Runs the specified task(s)...
* ```
Task names appear with raw formatting instead of clean completions.

**Cause:**
The `__task_get_tasks` function in `completion/fish/task.fish` uses:

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

The \s escape sequence (whitespace) is a GNU sed extension. BSD sed (macOS default) doesn't support it, so the pattern silently fails to match and passes through raw output.

Fix:
Replace \s\{2,\} with POSIX-compatible [[:space:]][[:space:]]* or simply * (two literal spaces followed by asterisk):

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

Tested on macOS 15.2 with BSD sed — the POSIX pattern correctly extracts task names and descriptions.

Note: Previous versions (before v3.46.1) used sed 's/: /\t/g' which was POSIX-compatible. The regression was introduced when PR #2532 rewrote the completion script.

Version

3.46.3 (introduced in v3.46.1)

Operating system

macOS 15.2 (Sequoia) with BSD sed

Experiments Enabled

No response

Example Taskfile

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: completionsChanges related to shell completions and scripts.

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions