diff options
| author | Mitchell Riedstra <mitch@riedstra.dev> | 2021-10-25 21:09:03 -0400 |
|---|---|---|
| committer | Mitchell Riedstra <mitch@riedstra.dev> | 2021-10-25 21:09:10 -0400 |
| commit | 34d76d7d76f7554f846e59b62e4d21d76a85d970 (patch) | |
| tree | ca0d6709cf3f1aa4161c710402a512caa96c4048 | |
| parent | 04154746f58048bf08368b6b71a7950ad7271cc3 (diff) | |
| download | dpw-34d76d7d76f7554f846e59b62e4d21d76a85d970.tar.gz dpw-34d76d7d76f7554f846e59b62e4d21d76a85d970.tar.xz | |
MacOS compatibility
| -rwxr-xr-x | dpw | 34 | ||||
| -rwxr-xr-x | dpw-gpg | 14 |
2 files changed, 36 insertions, 12 deletions
@@ -19,6 +19,30 @@ DPW_BACKEND="${DPW_BACKEND:-dpw-gpg}" OTP="${OATH:-oathtool} -b --totp" +_clip() { +case $(uname) in +Darwin) + pbcopy +;; +*) + xclip -selection "$PASSWORD_STORE_X_SELECTION" +:; +esac +} + +_clip_clear() { +case $(uname) in +Darwin) + sh -c "sleep ${PASSWORD_STORE_CLIP_TIME}; + printf '' | pbcopy" & +;; +*) + sh -c "sleep ${PASSWORD_STORE_CLIP_TIME}; + printf '' | xclip -selection '$PASSWORD_STORE_X_SELECTION'" & +:; +esac +} + _printH() { printf "%-25s # %s\n" "$@" } @@ -103,10 +127,9 @@ pth="$1"; shift "${DPW_BACKEND}" show "$pth" \ | sed 1q \ | tr -d '\n' \ - | xclip -selection "$PASSWORD_STORE_X_SELECTION" + | _clip -sh -c "sleep ${PASSWORD_STORE_CLIP_TIME}; - echo '' | xclip -selection '$PASSWORD_STORE_X_SELECTION'" & +_clip_clear } _type() { @@ -197,10 +220,9 @@ case $a in copy) $OTP "$authstring" \ | tr -d '\n' \ - | xclip -selection "$PASSWORD_STORE_X_SELECTION" + | _clip - sh -c "sleep ${PASSWORD_STORE_CLIP_TIME}; - echo '' | xclip -selection '$PASSWORD_STORE_X_SELECTION'" & + _clip_clear ;; type) $OTP "$authstring" \ @@ -96,12 +96,14 @@ _git_commit "Insert: $pth" } list() { -cd "$PASSWORD_STORE_DIR" -find ./"$1" -type f \ - | sed -e's@^\./@@g' \ - | sed -e'/^\./d' \ - | sed -e'/\.gpg-id$/d' \ - | sed -e's/\.gpg$//g' +find "$PASSWORD_STORE_DIR/$1" -type f -iname "*.gpg" \ + | while read -r line ; do + line="${line##$PASSWORD_STORE_DIR}" + line="${line#/}" + line="${line#/}" + line="${line%.gpg}" + echo "$line" + done } remove() { |
