aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xdpw34
-rwxr-xr-xdpw-gpg14
2 files changed, 36 insertions, 12 deletions
diff --git a/dpw b/dpw
index 4d93a9b..a9e6a75 100755
--- a/dpw
+++ b/dpw
@@ -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" \
diff --git a/dpw-gpg b/dpw-gpg
index 538520b..d26b665 100755
--- a/dpw-gpg
+++ b/dpw-gpg
@@ -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() {