From 0feed1f952385b6b041805db01012e5e4140f258 Mon Sep 17 00:00:00 2001 From: Mitchell Riedstra Date: Sun, 20 Nov 2022 21:28:53 -0500 Subject: Add a note about 'dpw-env' and allow editing on backends that don't support overwrite --- dpw | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/dpw b/dpw index a342366..29ed97e 100755 --- a/dpw +++ b/dpw @@ -1,5 +1,5 @@ #!/bin/sh -# Copyright 2021 Mitchell Riedstra +# Copyright 2022 Mitchell Riedstra # # Permission to use, copy, modify, and/or distribute this software for any purpose # with or without fee is hereby granted, provided that the above copyright notice @@ -84,6 +84,20 @@ If you're using oksh / OpenBSD KSH, completion can be installled with: show copy type list ls mv cp rm edit otp fnd find insert \\ && set -A complete_dpw_2 -- \$(dpw list) +If you would like to make exporting environment variables from passwords easy +a shell function can be used: + +dpw-env() { + _f="\$(mktemp)" + pass "\$@" > "\$_f" + #shellcheck disable=SC1090 + . "\$_f" + rm -f "\$_f" +} + +Just be careful, that will lead your shell to executaing whatever the contents +of that particular entry are. + EOF exit 0 @@ -180,6 +194,7 @@ _f="$(mktemp "${tmpdir}/dpw.XXXXXXXXXX")" trap "rm -f \"$_f\"; exit 0" EXIT INT show "$_pth" > "$_f" ${EDITOR:-vi} "$_f" +remove "$_pth" insert "$_pth" < "$_f" rm -f "$_f" } -- cgit v1.2.3