Skip to content

Commit 21d40d7

Browse files
YethalYethal
andauthored
Create to-ini.nu (nushell#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 <[email protected]>
1 parent 4a0f592 commit 21d40d7

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

formats/to-ini.nu

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# converts records into .ini files
2+
export def "to ini" [] {
3+
transpose key value
4+
| update value {|row|
5+
get value
6+
| transpose key value
7+
| format '{key}={value}'
8+
| prepend $"[($row.key)]"
9+
| str join (char nl)
10+
}
11+
| get value
12+
| str join (char nl)
13+
}

0 commit comments

Comments
 (0)