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

Using colima on an M1 mac, seems to be working one comment is that the text for the completions should change: #1589

Open
richtong opened this issue Jan 26, 2022 · 4 comments
Assignees
Labels
area/shell-completion All shell completions kind/documentation Documentation of cobra itself

Comments

@richtong
Copy link

Using colima on an M1 mac, seems to be working one comment is that the text for the completions should change:

colima completion zsh --help

Says you should pip it to /usr/local but with m1, this has moved to /opt/homebrew if it is installed that way, so it should say when you run colima completion zsh --help:

To load completions for every new session, execute once:
# Linux or MacOS M1:
$ colima completion zsh > "${fpath[1]}/_colima"
# macOS Intel:
$ colima completion zsh > /usr/local/share/zsh/site-functions/_colima
# if homebrew installed
$ colima completion zsh > $(brew --prefix)/share/zsh/site-function/_colima

As an aside, if you do not what to make it that complicate the at least for Linux and M1, you can just use the fpath. Finally,
this says run it once, but this means that completions will get stale if you ever change the file, so the safer thing to
do is to put this into ~/.zshrc or ~/.bash_profile so that it refreshes

Originally posted by @richtong in abiosoft/colima#98

@jpmcb
Copy link
Collaborator

jpmcb commented Feb 10, 2022

Thanks for opening this issue! Sounds like we need to document this better.

Happy to accept a PR for this.

@jpmcb jpmcb added kind/documentation Documentation of cobra itself needs PR labels Feb 10, 2022
@jpmcb jpmcb removed the needs PR label Feb 23, 2022
@marckhouzam
Copy link
Collaborator

Ok, so #1719 has fixed the Homebrew path. You are right that if brew is not installed or used, the help is not correct.
Do Mac's come with Homebrew pre-installed?

Finally, this says run it once, but this means that completions will get stale if you ever change the file,
so the safer thing to do is to put this into ~/.zshrc or ~/.bash_profile so that it refreshes

Normally, as long as the tool for which your are doing completion has not been updated, then the completion script will not change. So, you are right that "execute once" can be a bit misleading as it should probably say "execute once after installing a new version of the tool".

Adding it in .zshrc would work but if done of every tool, would start having an impact on load time of a new shell, which is something people have complained about.

PR welcomed to fine-tune the help printout.

@marckhouzam marckhouzam added area/shell-completion All shell completions help-wanted An issue that the maintainers would like help resolving and removed help-wanted An issue that the maintainers would like help resolving labels Sep 30, 2022
@jpmcb
Copy link
Collaborator

jpmcb commented Sep 30, 2022

Do Mac's come with Homebrew pre-installed?

They don't unfortunately. brew is a sort of "missing" third party package manager (since MacOS doesn't have anything like dnf or apt by default)

@richtong
Copy link
Author

richtong commented Oct 2, 2022

Happy to do this PR. thanks for fixing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/shell-completion All shell completions kind/documentation Documentation of cobra itself
Projects
None yet
Development

No branches or pull requests

3 participants