Skip to content
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 CLI autocompletion on ZSH when installed with Homebrew #443

Merged

Conversation

natemccurdy
Copy link
Contributor

Summary

Prior to this, when installing Timoni using Homebrew on a Mac with ZSH,
CLI autocompletion would not work.

After this change, CLI autocompletion works after installation or
reinstallation via Homebrew.

The problem is that the completion function that Homebrew wrote to
/opt/homebrew/share/zsh/site-functions/ did not start with an
underscore, _.

By convention, completion function names (and the files containing them)
should start with an underscore followed by the name of the command they
provide completions for. When ZSH's completion system is initialized
(usually through the compinit function), it automatically looks for
files in the fpath directories that start with an underscore.

Before this change

Autocompletion on MacOS with ZSH did not work:
broken

After this change

Autocompletion on MacOS with ZSH works. To test this, I just renamed /opt/homebrew/share/zsh/site-functions/timoni to /opt/homebrew/share/zsh/site-functions/_timoni then opened a new shell.
fixed

Prior to this, when installing Timoni using Homebrew on a Mac with ZSH,
CLI autocompletion would not work.

After this change, CLI autocompletion works after installation or
reinstallation via Homebrew.

The problem is that the completion function that Homebrew wrote to
`/opt/homebrew/share/zsh/site-functions/` did not start with an
underscore, `_`.

By convention, completion function names (and the files containing them)
should start with an underscore followed by the name of the command they
provide completions for. When ZSH's completion system is initialized
(usually through the compinit function), it automatically looks for
files in the fpath directories that start with an underscore.
@stefanprodan stefanprodan added the area/cli CLI related issues and pull requests label Nov 23, 2024
Copy link
Owner

@stefanprodan stefanprodan left a comment

Choose a reason for hiding this comment

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

LGTM

Thanks @natemccurdy

@stefanprodan stefanprodan merged commit aef66c0 into stefanprodan:main Nov 23, 2024
5 checks passed
@natemccurdy natemccurdy deleted the fix/brew_zsh_autocomplete branch November 23, 2024 08:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/cli CLI related issues and pull requests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants