heroku / heroku/cli

Broken autocomplete when installing CLI with homebrew on Linux

Open
#2,838 4 comments 0 reactions 0 assignees View on GitHub
bug on-call reviewed
Dominant language
TypeScript
Stars
889
Forks
236
Avg merge
2d 10h
Merged PRs (30d)
33

Description

# Bug report

## What is the current behavior?

The autocomplete is broken installing with homebrew on linux.

## Steps to reproduce it

1. brew tap heroku/brew && brew install heroku
2. heroku

It will show up a grep error message saying the file `$HOME/Library/Caches/heroku/autocomplete/commands`, which acctually don't.

## What is the expected behavior?

It shoud autocomplete with options.

## workaround

In the file `/home/linuxbrew/.linuxbrew/share/zsh/site-functions/_heroku` edit this two follow env vars.

```zsh
### Keep in sync with zsh shim
HEROKU_AC_ANALYTICS_DIR=$HOME/Library/Caches/heroku/autocomplete/completion_analytics;
HEROKU_AC_COMMANDS_PATH=$HOME/Library/Caches/heroku/autocomplete/commands;
```
Set it as bellow.

```zsh
### Keep in sync with zsh shim
HEROKU_AC_ANALYTICS_DIR=$HOME/.cache/heroku/autocomplete/completion_analytics;
HEROKU_AC_COMMANDS_PATH=$HOME/.cache/heroku/autocomplete/commands;
```
I belive the path are set to MacOS folders installations. So, check for OSTYPE could fix the problem.

```zsh
case "$OSTYPE" in
linux-gnu)
HEROKU_AC_ANALYTICS_DIR=$HOME/.cache/heroku/autocomplete/completion_analytics;
HEROKU_AC_COMMANDS_PATH=$HOME/.cache/heroku/autocomplete/commands;
;;
darwin)
HEROKU_AC_ANALYTICS_DIR=$HOME/Library/Caches/heroku/autocomplete/completion_analytics;
HEROKU_AC_COMMANDS_PATH=$HOME/Library/Caches/heroku/autocomplete/commands;
;;
esac

Heroku version: heroku/8.11.4 linux-x64 node-v16.20.2
SO: Ubuntu 22.04
Proxy: No proxy

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.