1
0
mirror of https://github.com/octoleo/Purse.git synced 2024-12-28 03:45:04 +00:00

Merge pull request #9 from drduh/wip-04jul24

Rename clip function
This commit is contained in:
drduh 2024-07-04 23:02:18 +00:00 committed by GitHub
commit bb75af004b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 6 additions and 5 deletions

View File

@ -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

View File

@ -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