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

Happi doesn't activate on zsh shell macOS M1 #100

Open
nfortune opened this issue Mar 25, 2024 · 2 comments
Open

Happi doesn't activate on zsh shell macOS M1 #100

nfortune opened this issue Mar 25, 2024 · 2 comments

Comments

@nfortune
Copy link

nfortune commented Mar 25, 2024

MacOS for M1 recommends use of zsh rather than bash and selects zsh as its default shell . Happi appears to require bash shell. Will yaqc-bluesky still work without Happi activation or should I switch from zsh to bash?

The Happi.sh code follows below:

#!/bin/bash
# This activates fzf-based fuzzy finding for happi searches.
# This is meant to be sourced from bash.

if [[ "${BASH}" =~ .*"bash" ]]; then
    # Do nothing
    :
else
    echo "'happi' activation: only bash shell is supported. Used shell: ${BASH}"
    return
fi

_fzf_complete_happi() {
  _fzf_complete --multi --reverse --prompt="happi> " -- "$@" < <(
    python `which happi` search '*' --json 2>/dev/null | python -c '
import json
import sys
items = json.load(sys.stdin)
for item in items:
    print(item["name"])
'

  )
}

[ -n "$BASH" ] && complete -F _fzf_complete_happi -o default -o bashdefault happi
@ksunden
Copy link
Member

ksunden commented Mar 26, 2024

This is a completely optional additional feature of upstream happi installing a hook for fzf, a fuzzy search cli program.

If you do not already use fzf, I certainly would not worry about it at all.

If you do use fzf, I think there should be a way to install the correct hook for zsh, and I have a strong suspicion upstream would be willing to add it.

The file that looks substantially the same in the happi repo is https://github.com/pcdshub/happi/blob/master/conda-recipe/activate.sh Which I will note seems to be:

  • Rewritten to avoid the error message/early return
  • renamed somewhere along the way
  • only relevant to conda-related things

Regardless, even here happi integration is a small add on that is absolutely no requirement.

@untzag
Copy link
Member

untzag commented Mar 27, 2024

Can you say a bit more @nfortune? Are you running into an error or warning while trying to use yaqc-bluesky?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants