Merge pull request #10 from dylanaraps/password_timer
pash: clear clipboard after a timer
This commit is contained in:
commit
cec7b05cf4
33
README.md
33
README.md
|
@ -26,6 +26,7 @@ pash
|
|||
* [How do I set the password length?](#how-do-i-set-the-password-length)
|
||||
* [How do I change the password store location?](#how-do-i-change-the-password-store-location)
|
||||
* [How do I change the clipboard tool?](#how-do-i-change-the-clipboard-tool)
|
||||
* [How do I change the clipboard timeout?](#how-do-i-change-the-clipboard-timeout)
|
||||
* [How do I change the password generation pattern?](#how-do-i-change-the-password-generation-pattern)
|
||||
* [How do I rename an entry?](#how-do-i-rename-an-entry)
|
||||
* [How can I migrate from `pass` to `pash`?](#how-can-i-migrate-from-pass-to-pash)
|
||||
|
@ -61,11 +62,12 @@ COMMANDS
|
|||
|
||||
OPTIONS
|
||||
|
||||
Using a key pair: export PASH_KEYID=XXXXXXXX
|
||||
Password length: export PASH_LENGTH=50
|
||||
Password pattern: export PASH_PATTERN=_A-Z-a-z-0-9
|
||||
Store location: export PASH_DIR=~/.local/share/pash
|
||||
Clipboard tool: export PASH_CLIP='xclip -selection clipboard'
|
||||
Using a key pair: export PASH_KEYID=XXXXXXXX
|
||||
Password length: export PASH_LENGTH=50
|
||||
Password pattern: export PASH_PATTERN=_A-Z-a-z-0-9
|
||||
Store location: export PASH_DIR=~/.local/share/pash
|
||||
Clipboard tool: export PASH_CLIP='xclip -sel c'
|
||||
Clipboard timeout: export PASH_TIMEOUT=15 ('off' to disable)
|
||||
```
|
||||
|
||||
## FAQ
|
||||
|
@ -129,11 +131,26 @@ PASH_DIR=/mnt/drive/pash pash list
|
|||
Set the environment variable `PASH_CLIP` to a command.
|
||||
|
||||
```sh
|
||||
# Default: 'xclip -selection clipboard'.
|
||||
export PASH_CLIP='xclip -selection clipboard'
|
||||
# Default: 'xclip -sel c'.
|
||||
export PASH_CLIP='xclip -sel c'
|
||||
|
||||
# This can also be used as a one-off.
|
||||
PASH_CLIP='xclip -selection clipboard' pash copy github
|
||||
PASH_CLIP='xclip -sel c' pash copy github
|
||||
```
|
||||
|
||||
### How do I change the clipboard timeout?
|
||||
|
||||
Set the environment variable `PASH_TIMEOUT` to a valid `sleep` interval or `off` to disable the feature.
|
||||
|
||||
```sh
|
||||
# Default: '15'
|
||||
export PASH_TIMEOUT=15
|
||||
|
||||
# Disable timeout.
|
||||
export PASH_TIMEOUT=off
|
||||
|
||||
# This can also be used as a one-off.
|
||||
PASH_TIMEOUT=5 pash copy github
|
||||
```
|
||||
|
||||
### How do I change the password generation pattern?
|
||||
|
|
28
pash
28
pash
|
@ -67,7 +67,22 @@ pw_copy() {
|
|||
# Disable warning against word-splitting as it is safe
|
||||
# and intentional (globbing is disabled).
|
||||
# shellcheck disable=2086
|
||||
pw_show "$1" | ${PASH_CLIP:-xclip -selection clipboard}
|
||||
: "${PASH_CLIP:=xclip -sel c}"
|
||||
|
||||
# Wait in the background for the password timeout and
|
||||
# clear the clipboard when the timer runs out.
|
||||
#
|
||||
# If the 'sleep' fails, kill the script. This is the
|
||||
# simplest method of aborting from a subshell.
|
||||
[ "$PASH_TIMEOUT" != off ] && {
|
||||
printf 'Clearing clipboard in "%s" seconds.\n' \
|
||||
"${PASH_TIMEOUT:=15}"
|
||||
|
||||
sleep "$PASH_TIMEOUT" || kill 0
|
||||
$PASH_CLIP </dev/null
|
||||
} &
|
||||
|
||||
pw_show "$1" | $PASH_CLIP
|
||||
}
|
||||
|
||||
pw_list() {
|
||||
|
@ -128,11 +143,12 @@ pash 2.1.0 - simple password manager.
|
|||
=> [l]ist - List all entries.
|
||||
=> [s]how [name] - Show password for an entry.
|
||||
|
||||
Using a key pair: export PASH_KEYID=XXXXXXXX
|
||||
Password length: export PASH_LENGTH=50
|
||||
Password pattern: export PASH_PATTERN=_A-Z-a-z-0-9
|
||||
Store location: export PASH_DIR=~/.local/share/pash
|
||||
Clipboard tool: export PASH_CLIP='xclip -selection clipboard'
|
||||
Using a key pair: export PASH_KEYID=XXXXXXXX
|
||||
Password length: export PASH_LENGTH=50
|
||||
Password pattern: export PASH_PATTERN=_A-Z-a-z-0-9
|
||||
Store location: export PASH_DIR=~/.local/share/pash
|
||||
Clipboard tool: export PASH_CLIP='xclip -sel c'
|
||||
Clipboard timeout: export PASH_TIMEOUT=15 ('off' to disable)
|
||||
"
|
||||
exit 1
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue