summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Smith <luke@lukesmith.xyz>2023-08-23 11:06:11 +0000
committerGitHub <noreply@github.com>2023-08-23 11:06:11 +0000
commit7a1fe918a12f49970c15b4018f5676b673743094 (patch)
treefafd757cb109ee815fadbd56d0cb33b6f38382ec
parent07e4bb14e0b15cf4fe94a1478386f78a19cf00a6 (diff)
parent268da5d51b1e710f244507296f911cd847fb8dbe (diff)
Merge pull request #953 from rampaq/pipe-to-pass
pipe password directly to pass
-rwxr-xr-xbin/mw12
1 files changed, 3 insertions, 9 deletions
diff --git a/bin/mw b/bin/mw
index 81c75d9..eaec3a9 100755
--- a/bin/mw
+++ b/bin/mw
@@ -174,20 +174,14 @@ askinfo() {
hostname="${fulladdr#*@}"
login="${login:-$fulladdr}"
if [ -n "${password+x}" ]; then
- createpass
+ insertpass
else
getpass
fi
}
-createpass() {
- echo "$password" >"$PASSWORD_STORE_DIR/$passprefix$fulladdr"
- "$GPG" -qe $(printf -- " -r %s" $(cat "$PASSWORD_STORE_DIR/.gpg-id")) "$PASSWORD_STORE_DIR/$passprefix$fulladdr"
- case "$(uname)" in
- Darwin | *BSD) rm -P "$PASSWORD_STORE_DIR/$passprefix$fulladdr" ;;
- *) shred -u "$PASSWORD_STORE_DIR/$passprefix$fulladdr" ;;
- esac
- rm -f "$PASSWORD_STORE_DIR/$passprefix$fulladdr"
+insertpass() {
+ printf "%s" "$password" | pass insert -fe "$PASSWORD_STORE_DIR/$passprefix$fulladdr"
}
errorexit() {