Skip to content

Conversation

@amoses12
Copy link

@amoses12 amoses12 commented Jan 6, 2026

Release Note: Fix CLI completions installation on silicon Macs.

Closes ENG-8130

@amoses12 amoses12 requested a review from a team as a code owner January 6, 2026 18:07
Comment on lines 100 to 116
if utils.IsMacOS() {
homeDir, err := os.UserHomeDir()
if err != nil {
utils.HandleError(err, "Unable to determine home directory")
}
// Check if oh-my-zsh is installed - it auto-adds ~/.oh-my-zsh/completions to fpath
omzDir := fmt.Sprintf("%s/.oh-my-zsh", homeDir)
if utils.Exists(omzDir) {
path = fmt.Sprintf("%s/.oh-my-zsh/completions", homeDir)
usingOhMyZsh = true
} else {
// Fall back to ~/.zsh/completions for non-oh-my-zsh users
path = fmt.Sprintf("%s/.zsh/completions", homeDir)
}
} else {
path = "/usr/local/share/zsh/site-functions"
}
Copy link
Member

Choose a reason for hiding this comment

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

nit: I'd really prefer for this to be OS-agnostic, and not have any special handling for OMZ (since it really doesn't matter). It's not guaranteed for /usr/local/share/ to be writable on other OSes either so we need to gracefully handle when it's not.

}

// Write the fpath configuration block
configBlock := fmt.Sprintf("\n# Doppler CLI completions\n%s\nautoload -Uz compinit && compinit\n", fpathLine)
Copy link
Member

Choose a reason for hiding this comment

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

blocking: I don't trust that this will be reliable across all possible environments. Best case, we slow down every user's shell startup time by calling compinit unnecessarily, in others cases we might actually break things by doing this.

I'd much rather just print the line that needs to be added to the user's file in the case that it needs to be added manually, and expect the user to add it to the correct place.

usingOhMyZsh = true
} else {
// Fall back to ~/.zsh/completions for non-oh-my-zsh users
path = fmt.Sprintf("%s/.zsh/completions", homeDir)
Copy link
Member

Choose a reason for hiding this comment

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

nit: I would not expect another program to write to this directory unless it were very well know and standardized, which is not the case here. We should be writing to our own directory.

Copy link
Author

Choose a reason for hiding this comment

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

@emily-curry just to clarify, we do write it to a file named "_doppler", so everything gets written to "~/.zsh/completions/_doppler". Do we want to write this to a new directory entirely or does the filename suffice?

@amoses12 amoses12 force-pushed the austin/mac-completions-install branch from d2fe889 to 4bc777a Compare January 6, 2026 23:24
@amoses12 amoses12 requested a review from emily-curry January 6, 2026 23:26
@amoses12 amoses12 force-pushed the austin/mac-completions-install branch from 4bc777a to b64ba0c Compare January 7, 2026 16:37
emily-curry
emily-curry previously approved these changes Jan 7, 2026
Copy link
Member

Choose a reason for hiding this comment

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

nit: This file isn't added to tests/e2e.sh, so it won't be run in CI.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants