spectre-cli/spectre.bashrc

25 lines
615 B
Text
Raw Normal View History

## 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
2014-06-10 22:25:35 +02:00
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
}