2021-02-18 04:50:01 +01:00
|
|
|
## Added by Spectre
|
2014-06-07 21:51:11 +02:00
|
|
|
source bashlib
|
2021-02-28 16:28:16 +01:00
|
|
|
spectre() {
|
2014-06-07 21:51:11 +02:00
|
|
|
_copy() {
|
|
|
|
if hash pbcopy 2>/dev/null; then
|
|
|
|
pbcopy
|
|
|
|
elif hash xclip 2>/dev/null; then
|
2016-10-20 22:33:11 +02:00
|
|
|
xclip -selection clip
|
2014-06-07 21:51:11 +02:00
|
|
|
else
|
2014-06-10 22:25:35 +02:00
|
|
|
cat; echo 2>/dev/null
|
2014-06-07 21:51:11 +02:00
|
|
|
return
|
|
|
|
fi
|
|
|
|
echo >&2 "Copied!"
|
|
|
|
}
|
|
|
|
|
|
|
|
# Empty the clipboard
|
|
|
|
:| _copy 2>/dev/null
|
|
|
|
|
|
|
|
# Ask for the user's name and password if not yet known.
|
2021-02-28 16:28:16 +01:00
|
|
|
SPECTRE_USERNAME=${SPECTRE_USERNAME:-$(ask 'Your Full Name:')}
|
2014-06-07 21:51:11 +02:00
|
|
|
|
2021-02-18 04:50:01 +01:00
|
|
|
# Start Spectre and copy the output.
|
2021-02-28 16:28:16 +01:00
|
|
|
printf %s "$(SPECTRE_USERNAME=$SPECTRE_USERNAME command spectre "$@")" | _copy
|
2014-06-07 21:51:11 +02:00
|
|
|
}
|