2014-06-07 19:51:11 +00:00
|
|
|
## Added by Master Password
|
|
|
|
source bashlib
|
|
|
|
mpw() {
|
|
|
|
_copy() {
|
|
|
|
if hash pbcopy 2>/dev/null; then
|
|
|
|
pbcopy
|
|
|
|
elif hash xclip 2>/dev/null; then
|
2016-10-20 20:33:11 +00:00
|
|
|
xclip -selection clip
|
2014-06-07 19:51:11 +00:00
|
|
|
else
|
2014-06-10 20:25:35 +00:00
|
|
|
cat; echo 2>/dev/null
|
2014-06-07 19:51:11 +00: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.
|
2017-09-15 17:24:45 +00:00
|
|
|
MPW_FULLNAME=${MPW_FULLNAME:-$(ask 'Your Full Name:')}
|
2014-06-07 19:51:11 +00:00
|
|
|
|
|
|
|
# Start Master Password and copy the output.
|
2017-09-15 17:24:45 +00:00
|
|
|
printf %s "$(MPW_FULLNAME=$MPW_FULLNAME command mpw "$@")" | _copy
|
2014-06-07 19:51:11 +00:00
|
|
|
}
|