pash: clear clipboard after a timer
This commit is contained in:
parent
7b3be8069c
commit
328ca19ad6
24
README.md
24
README.md
|
@ -26,6 +26,7 @@ pash
|
||||||
* [How do I set the password length?](#how-do-i-set-the-password-length)
|
* [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 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 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 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 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)
|
* [How can I migrate from `pass` to `pash`?](#how-can-i-migrate-from-pass-to-pash)
|
||||||
|
@ -61,11 +62,12 @@ COMMANDS
|
||||||
|
|
||||||
OPTIONS
|
OPTIONS
|
||||||
|
|
||||||
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
|
||||||
Password pattern: export PASH_PATTERN=_A-Z-a-z-0-9
|
Password pattern: export PASH_PATTERN=_A-Z-a-z-0-9
|
||||||
Store location: export PASH_DIR=~/.local/share/pash
|
Store location: export PASH_DIR=~/.local/share/pash
|
||||||
Clipboard tool: export PASH_CLIP='xclip -selection clipboard'
|
Clipboard tool: export PASH_CLIP='xclip -selection clipboard'
|
||||||
|
Clipboard timeout: export PASH_TIMEOUT=10
|
||||||
```
|
```
|
||||||
|
|
||||||
## FAQ
|
## FAQ
|
||||||
|
@ -136,6 +138,18 @@ export PASH_CLIP='xclip -selection clipboard'
|
||||||
PASH_CLIP='xclip -selection clipboard' pash copy github
|
PASH_CLIP='xclip -selection clipboard' pash copy github
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### How do I change the clipboard timeout?
|
||||||
|
|
||||||
|
Set the environment variable `PASH_TIMEOUT` to a command.
|
||||||
|
|
||||||
|
```sh
|
||||||
|
# Default: '10'
|
||||||
|
export PASH_TIMEOUT=10
|
||||||
|
|
||||||
|
# This can also be used as a one-off.
|
||||||
|
PASH_TIMEOUT=5 pash copy github
|
||||||
|
```
|
||||||
|
|
||||||
### How do I change the password generation pattern?
|
### How do I change the password generation pattern?
|
||||||
|
|
||||||
Set the environment variable `PASH_PATTERN` to a valid `tr` string.
|
Set the environment variable `PASH_PATTERN` to a valid `tr` string.
|
||||||
|
|
23
pash
23
pash
|
@ -58,7 +58,17 @@ pw_copy() {
|
||||||
# Disable warning against word-splitting as it is safe
|
# Disable warning against word-splitting as it is safe
|
||||||
# and intentional (globbing is disabled).
|
# and intentional (globbing is disabled).
|
||||||
# shellcheck disable=2086
|
# shellcheck disable=2086
|
||||||
pw_show "$1" | ${PASH_CLIP:-xclip -selection clipboard}
|
: "${PASH_CLIP:=xclip -selection clipboard}"
|
||||||
|
|
||||||
|
# Wait in the background for the password timeout and
|
||||||
|
# clear the clipboard when the timer runs out.
|
||||||
|
(
|
||||||
|
printf 'Clearing clipboard in %d seconds.\n' "${PASH_TIMEOUT:=10}"
|
||||||
|
sleep "$PASH_TIMEOUT"
|
||||||
|
printf '' | $PASH_CLIP
|
||||||
|
) &
|
||||||
|
|
||||||
|
pw_show "$1" | $PASH_CLIP
|
||||||
}
|
}
|
||||||
|
|
||||||
pw_list() {
|
pw_list() {
|
||||||
|
@ -119,11 +129,12 @@ pash 2.1.0 - simple password manager.
|
||||||
=> [l]ist - List all entries.
|
=> [l]ist - List all entries.
|
||||||
=> [s]how [name] - Show password for an entry.
|
=> [s]how [name] - Show password for an entry.
|
||||||
|
|
||||||
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
|
||||||
Password pattern: export PASH_PATTERN=_A-Z-a-z-0-9
|
Password pattern: export PASH_PATTERN=_A-Z-a-z-0-9
|
||||||
Store location: export PASH_DIR=~/.local/share/pash
|
Store location: export PASH_DIR=~/.local/share/pash
|
||||||
Clipboard tool: export PASH_CLIP='xclip -selection clipboard'
|
Clipboard tool: export PASH_CLIP='xclip -selection clipboard'
|
||||||
|
Clipboard timeout: export PASH_TIMEOUT=10
|
||||||
"
|
"
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue