1
Fork 0
mirror of https://github.com/RGBCube/nu_scripts synced 2025-08-02 07:07:46 +00:00

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 <nosuchemail@email.com>
This commit is contained in:
Yethal 2023-02-22 14:30:25 +01:00 committed by GitHub
parent 4a0f59265d
commit 21d40d7318
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

13
formats/to-ini.nu Normal file
View file

@ -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)
}