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:
parent
4a0f59265d
commit
21d40d7318
1 changed files with 13 additions and 0 deletions
13
formats/to-ini.nu
Normal file
13
formats/to-ini.nu
Normal 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)
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue