recursiveGetAttrsetWithJqPrefix: fix top level values

Co-authored-by: linyinfeng <lin.yinfeng@outlook.com>
This commit is contained in:
Sizhe Zhao 2025-08-16 16:00:19 +08:00
parent 0974f0729a
commit c4bfbd8926
No known key found for this signature in database
GPG Key ID: ED1807251A7DA08F

View File

@ -219,14 +219,14 @@ let
let let
escapedName = ''"${replaceStrings [ ''"'' "\\" ] [ ''\"'' "\\\\" ] name}"''; escapedName = ''"${replaceStrings [ ''"'' "\\" ] [ ''\"'' "\\\\" ] name}"'';
in in
recurse (prefix + "." + escapedName) item.${name} recurse (prefix + (if prefix == "." then "" else ".") + escapedName) item.${name}
) (attrNames item) ) (attrNames item)
else if isList item then else if isList item then
imap0 (index: item: recurse (prefix + "[${toString index}]") item) item imap0 (index: item: recurse (prefix + "[${toString index}]") item) item
else else
[ ]; [ ];
in in
listToAttrs (flatten (recurse "" item)); listToAttrs (flatten (recurse "." item));
/* /*
Takes an attrset and a file path and generates a bash snippet that Takes an attrset and a file path and generates a bash snippet that