From 21d40d73181d6bdc616d4306638f7026c9f07863 Mon Sep 17 00:00:00 2001 From: Yethal <26117918+Yethal@users.noreply.github.com> Date: Wed, 22 Feb 2023 14:30:25 +0100 Subject: [PATCH] Create to-ini.nu (#386) * Create to-ini.nu Nushell doesn't have a builtin serializer for ini files and I needed it for awscli profiles so here it is. * moved to formats subdir --------- Co-authored-by: Yethal --- formats/to-ini.nu | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 formats/to-ini.nu diff --git a/formats/to-ini.nu b/formats/to-ini.nu new file mode 100644 index 0000000..80ea10d --- /dev/null +++ b/formats/to-ini.nu @@ -0,0 +1,13 @@ +# converts records into .ini files +export def "to ini" [] { + transpose key value + | update value {|row| + get value + | transpose key value + | format '{key}={value}' + | prepend $"[($row.key)]" + | str join (char nl) + } + | get value + | str join (char nl) +}