mirror of
https://github.com/octoleo/Purse.git
synced 2024-09-07 19:09:03 +00:00
Rename clip function
This commit is contained in:
parent
849920c1b1
commit
70e48984e8
@ -66,7 +66,7 @@ tar xvf purse*tar
|
||||
|
||||
Several customizable options and features are also available, and can be configured with environment variables, for example in the [shell rc](https://github.com/drduh/config/blob/master/zshrc) file:
|
||||
|
||||
Variable | Description | Default | Values
|
||||
Variable | Description | Default | Available options
|
||||
-|-|-|-
|
||||
`PURSE_CLIP` | clipboard to use | `xclip` | `pbcopy` on macOS
|
||||
`PURSE_CLIP_ARGS` | arguments to pass to clipboard command | unset (disabled) | `-i -selection clipboard` to use primary (control-v) clipboard with xclip
|
||||
|
9
purse.sh
9
purse.sh
@ -133,7 +133,7 @@ read_pass () {
|
||||
fail "Secret not available" ; fi
|
||||
|
||||
prompt_key "password"
|
||||
clip <(decrypt "${spath}" | head -1) || \
|
||||
emit_pass <(decrypt "${spath}" | head -1) || \
|
||||
fail "Failed to decrypt ${spath}"
|
||||
}
|
||||
|
||||
@ -152,7 +152,8 @@ generate_pass () {
|
||||
else length="${3}" ; fi
|
||||
|
||||
if [[ "${length}" =~ ^[0-9]+$ ]] ; then
|
||||
pass_len="${length}" ; fi
|
||||
pass_len="${length}"
|
||||
fi
|
||||
|
||||
tr -dc "${pass_chars}" < /dev/urandom | \
|
||||
fold -w "${pass_len}" | head -1
|
||||
@ -175,7 +176,7 @@ write_pass () {
|
||||
fold -w10 | head -1)"
|
||||
|
||||
if [[ -n "${pass_copy}" ]] ; then
|
||||
clip <(printf '%s' "${userpass}") ; fi
|
||||
emit_pass <(printf '%s' "${userpass}") ; fi
|
||||
|
||||
printf '%s\n' "${userpass}" | encrypt "${spath}" - || \
|
||||
fail "Failed saving ${spath}"
|
||||
@ -220,7 +221,7 @@ backup () {
|
||||
else warn "${safe_backup} exists, skipping archive" ; fi
|
||||
}
|
||||
|
||||
clip () {
|
||||
emit_pass () {
|
||||
# Use clipboard or stdout and clear after timeout.
|
||||
|
||||
if [[ "${clip_dest}" = "screen" ]] ; then
|
||||
|
Loading…
Reference in New Issue
Block a user