cashapp / hermit

🐚 Hermit manages isolated, self-bootstrapping sets of tools in software projects.
https://cashapp.github.io/hermit
Apache License 2.0
588 stars 51 forks source link

Support Fish shell, or don't try to install into Fish with ZSH syntax #417

Open JakeWharton opened 2 hours ago

JakeWharton commented 2 hours ago

Hi! My corporate ~spyware~ MDM software has forced this tool onto my system. This would be fine, except that you install shell support into Fish using ZSH syntax.

This is in my ~/.config/fish/config.fish:

# Generated by Hermit; START; DO NOT EDIT.
HERMIT_ROOT_BIN="${HERMIT_ROOT_BIN:-"$HOME/bin/hermit"}"
eval "$(test -x $HERMIT_ROOT_BIN && $HERMIT_ROOT_BIN shell-hooks --print --zsh)"
# Generated by Hermit; END; DO NOT EDIT.
######

This causes Fish to produce this error:

~/.config/fish/config.fish (line 8): Unsupported use of '='. In fish, please use 'set HERMIT_ROOT_BIN "${HERMIT_ROOT_BIN:-"$HOME/bin/hermit"}"'.
HERMIT_ROOT_BIN="${HERMIT_ROOT_BIN:-"$HOME/bin/hermit"}"
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
from sourcing file ~/.config/fish/config.fish
source: Error while reading file '/Users/jw/.config/fish/config.fish'

I checked for --fish, but it doesn't exist:

~/bin/hermit shell-hooks --print --fish
Usage: hermit shell-hooks (install-hooks)

Manage Hermit auto-activation hooks of a shell.

Flags:
  -h, --help                 Show context-sensitive help.
      --version              Show version.
  -d, --debug                Enable debug logging.
  -t, --trace                Enable trace logging.
  -q, --quiet                Disable logging and progress UI, except fatal errors ($HERMIT_QUIET).
      --level=auto           Set minimum log level (auto,trace,debug,info,warn,error,fatal) ($HERMIT_LOG).
      --lock-timeout=30s     Timeout for waiting on the lock ($HERMIT_LOCK_TIMEOUT)
      --env=KEY=VALUE;...    Extra environment variables to apply to environments.

Command flags:
  --zsh     Update Zsh hooks.
  --bash    Update Bash hooks.

hermit: error: unknown flag --fish, did you mean one of "--zsh", "--bash"?

Please either:

alecthomas commented 2 hours ago

I don't believe it is Hermit doing this, it doesn't know about ~/.config/fish/config.fish at all. IIUC this is something done explicitly by the internal tooling :(

JakeWharton commented 2 hours ago

Ah, that's good to know. Thanks! I'm chasing them down for other invalid syntax they put into that file, so I'll be sure to mention this, too.

You can strikethrough like 90% of the original issue and keep it solely as a simple feature request for --fish if you want.