Skip to content

Commit

Permalink
Merge pull request #953 from rampaq/pipe-to-pass
Browse files Browse the repository at this point in the history
pipe password directly to pass
  • Loading branch information
LukeSmithxyz authored Aug 23, 2023
2 parents 07e4bb1 + 268da5d commit 7a1fe91
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions bin/mw
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down

0 comments on commit 7a1fe91

Please sign in to comment.