pash: Added PASH_CLIP to control clipboard command
This commit is contained in:
parent
f163bb91ed
commit
750c0f4f8b
10
README.md
10
README.md
@ -28,6 +28,7 @@ pash
|
|||||||
* [How do I change the password store location?](#how-do-i-change-the-password-store-location)
|
* [How do I change the password store location?](#how-do-i-change-the-password-store-location)
|
||||||
* [How do I rename an entry?](#how-do-i-rename-an-entry)
|
* [How do I rename an entry?](#how-do-i-rename-an-entry)
|
||||||
* [How can I extend `pash`?](#how-can-i-extend-pash)
|
* [How can I extend `pash`?](#how-can-i-extend-pash)
|
||||||
|
* [How do I change the clipboard tool?](#how-do-i-change-the-clipboard-tool)
|
||||||
|
|
||||||
<!-- vim-markdown-toc -->
|
<!-- vim-markdown-toc -->
|
||||||
|
|
||||||
@ -146,3 +147,12 @@ pash() {
|
|||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## How do I change the clipboard tool?
|
||||||
|
|
||||||
|
Set the environment variable `PASH_CLIP` to a command.
|
||||||
|
|
||||||
|
```sh
|
||||||
|
# Default: 'xclip -selection clipboard'.
|
||||||
|
export PASH_DIR='xclip -selection clipboard'
|
||||||
|
```
|
||||||
|
17
pash
17
pash
@ -44,7 +44,7 @@ pw_add() {
|
|||||||
# Use 'gpg' to store the password in an encrypted file. The
|
# Use 'gpg' to store the password in an encrypted file. The
|
||||||
# 'GPG_TTY' environment variable is set to workaround cases
|
# 'GPG_TTY' environment variable is set to workaround cases
|
||||||
# where 'gpg' cannot find an attached terminal.
|
# where 'gpg' cannot find an attached terminal.
|
||||||
echo "$pass" | "$gpg" "$@" -o "$name.gpg" &&
|
printf %s "$pass" | "$gpg" "$@" -o "$name.gpg" &&
|
||||||
printf '%s\n' "Saved '$name' to the store."
|
printf '%s\n' "Saved '$name' to the store."
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -67,12 +67,16 @@ pw_show() {
|
|||||||
pw_copy() {
|
pw_copy() {
|
||||||
pw_show "$1" copy
|
pw_show "$1" copy
|
||||||
|
|
||||||
if [ "$TMUX" ]; then
|
# Disable warning against words-splitting as it is safe
|
||||||
tmux load-buffer "$pass"
|
# and intentional. The '-f' disables globbing while the
|
||||||
|
# clipboard string is split.
|
||||||
|
# shellcheck disable=2086
|
||||||
|
{
|
||||||
|
set -f
|
||||||
|
set +f ${PASH_CLIP:-xclip -selection clipboard}
|
||||||
|
}
|
||||||
|
|
||||||
elif hash xclip; then
|
printf %s "$pass" | "$@"
|
||||||
echo "$pass" | xclip -selection clipboard
|
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pw_list() {
|
pw_list() {
|
||||||
@ -134,6 +138,7 @@ pash 1.0.0 - simple password manager.
|
|||||||
Using a key pair: export PASH_KEYID=XXXXXXXX
|
Using a key pair: export PASH_KEYID=XXXXXXXX
|
||||||
Password length: export PASH_LENGTH=50
|
Password length: export PASH_LENGTH=50
|
||||||
Store location: export PASH_DIR=~/.local/share/pash
|
Store location: export PASH_DIR=~/.local/share/pash
|
||||||
|
Clipboard tool: export PASH_CLIP=''
|
||||||
"
|
"
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user