[PATCH] Allow comments in .gpg-id
Kjetil Torgrim Homme
kjetil.homme at redpill-linpro.com
Wed Dec 18 12:16:56 CET 2019
On 18/12/2019 11.39, Rune Juhl Jacobsen wrote:
> Ouch, it seems like my editor ate a newline in the diff; sorry.
> Hopefully this works better...
>
>
> diff --git a/src/password-store.sh b/src/password-store.sh
> index 77f3eda..ce3f7fb 100755
> --- a/src/password-store.sh
> +++ b/src/password-store.sh
> @@ -99,7 +99,7 @@ set_gpg_recipients() {
> verify_file "$current"
>
> local gpg_id
> - while read -r gpg_id; do
> + grep -Eo '^[^#]+' | grep -Ev '^\s*$' | while read -r gpg_id; do
> GPG_RECIPIENT_ARGS+=( "-r" "$gpg_id" )
> GPG_RECIPIENTS+=( "$gpg_id" )
> done < "$current"
grep -o is very useful, but not portable (not in POSIX).
https://pubs.opengroup.org/onlinepubs/009695399/utilities/grep.html
>> "Amir Yalon" <quoiceehoh-20180826 at yxejamir.net> writes:
>>> It may be simpler to do gpg_id="${gpg_id%%#*}" instead.
indeed, that is much simpler and more sensible! why didn't I think of
that :-)
--- src/password-store.sh
+++ src/password-store.sh
@@ -99,6 +99,7 @@ set_gpg_recipients() {
local gpg_id
while read -r gpg_id; do
+ gpg_id="${gpg_id%%#*}" # strip comment
GPG_RECIPIENT_ARGS+=( "-r" "$gpg_id" )
GPG_RECIPIENTS+=( "$gpg_id" )
done < "$current"
--
Kjetil T. Homme
Redpill Linpro - Changing the Game
More information about the Password-Store
mailing list