mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-22 06:53:01 +00:00
formats.javaProperties: Add comment
This commit is contained in:
parent
4f8e44394c
commit
9a0739cbe2
@ -1,6 +1,6 @@
|
||||
{ lib, pkgs }:
|
||||
{
|
||||
javaProperties = {}: {
|
||||
javaProperties = { comment ? "Generated with Nix" }: {
|
||||
type = lib.types.attrsOf lib.types.str;
|
||||
|
||||
generate = name: value:
|
||||
@ -76,10 +76,15 @@
|
||||
|
||||
inputEncoding = "UTF-8";
|
||||
|
||||
inherit comment;
|
||||
|
||||
} ''
|
||||
jq -r --arg hash '#' "$jqCode" "$valuePath" \
|
||||
| iconv --from-code "$inputEncoding" --to-code JAVA \
|
||||
> "$out"
|
||||
(
|
||||
echo "$comment" | while read -r ln; do echo "# $ln"; done
|
||||
echo
|
||||
jq -r --arg hash '#' "$jqCode" "$valuePath" \
|
||||
| iconv --from-code "$inputEncoding" --to-code JAVA \
|
||||
) > "$out"
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
@ -179,6 +179,8 @@ in runBuildTests {
|
||||
"الجبر" = "أكثر من مجرد أرقام";
|
||||
};
|
||||
expected = ''
|
||||
# Generated with Nix
|
||||
|
||||
1 = 2
|
||||
foo = bar
|
||||
\u00fctf\ 8 = d\u00fbh
|
||||
|
Loading…
Reference in New Issue
Block a user