PDA

View Full Version : Spectre CLI: coding for .zshrc



cmonty14
2023-04-30, 13:18
Hi,

I want to use Spectre in CLI (https://gitlab.com/spectre.app/cli) with ZSH. Can you please advise the coding for .zshrc file?
This coding is not working:
## Added by Spectre
#source bashlib
spectre() {
_copy() {
if hash pbcopy 2>/dev/null; then
pbcopy
elif hash xclip 2>/dev/null; then
xclip -selection clip
else
cat; echo 2>/dev/null
return
fi
echo >&2 "Copied!"
}

# Empty the clipboard
:| _copy 2>/dev/null

# Ask for the user's name and password if not yet known.
SPECTRE_USERNAME=${SPECTRE_USERNAME:-$(ask 'Your Full Name:')}

# Start Spectre and copy the output.
printf %s "$(SPECTRE_USERNAME=$SPECTRE_USERNAME command spectre "$@")" | _copy
}
export SPECTRE_USERNAME=Joe\ Smith

THX