Improve keys function for keys with extra newlines

This commit is contained in:
c4710n 2024-03-15 11:51:47 +08:00
parent 8cb01a0e71
commit 2c9abfec86
No known key found for this signature in database
GPG Key ID: CA64A1BE51CB6DA2
2 changed files with 3 additions and 1 deletions

View File

@ -3,6 +3,7 @@
stdenv,
age,
jq,
gnused,
nix,
mktemp,
diffutils,
@ -18,6 +19,7 @@ in
src = substituteAll {
inherit ageBin version;
jqBin = "${jq}/bin/jq";
sedBin = "${gnused}/bin/sed";
nixInstantiate = "${nix}/bin/nix-instantiate";
mktempBin = "${mktemp}/bin/mktemp";
diffBin = "${diffutils}/bin/diff";

View File

@ -115,7 +115,7 @@ function cleanup {
trap "cleanup" 0 2 3 15
function keys {
(@nixInstantiate@ --json --eval --strict -E "(let rules = import $RULES; in rules.\"$1\".publicKeys)" | @jqBin@ -r .[]) || exit 1
(@nixInstantiate@ --json --eval --strict -E "(let rules = import $RULES; in rules.\"$1\".publicKeys)" | @jqBin@ -r .[] | @sedBin@ '/^$/d') || exit 1
}
function decrypt {