@ -620,10 +620,10 @@ function _get_users_in_gpg_keyring {
args += ( "--homedir" " $homedir " )
args += ( "--homedir" " $homedir " )
fi
fi
# pluck out 'uid' lines, fetch 10th field, extract part in <> if it exists (else leave alone).
# we use --fixed-list-mode so older versions of gpg emit 'uid:' lines.
# we use --fixed-list-mode so older versions of gpg emit 'uid:' lines.
# sed at the end is to extract email from <>. (If there's no <>, then the line is just an email address anyway.)
# here gawk splits on colon as --with-colon, exact matches field 1 as 'uid', and selects field 10 "User-ID"
result = $( $SECRETS_GPG_COMMAND " ${ args [@] } " --no-permission-warning --list-public-keys --with-colon --fixed-list-mode | grep ^uid: | cut -d: -f10 | sed 's/.*<\(.*\)>.*/\1/' )
# the gensub regex extracts email from <> within field 10. (If there's no <>, then field is just an email address anyway and the regex just passes it through.)
result = $( $SECRETS_GPG_COMMAND " ${ args [@] } " --no-permission-warning --list-public-keys --with-colon --fixed-list-mode | gawk -F: '$1~/uid/{print gensub(/.*<(.*)>.*/, "\\1", "g", $10); }' )
echo " $result "
echo " $result "
}
}