from ini for formats
Parse text as .ini and create table.
Signature
> from ini {flags}
Flags
--no-quote, -q: Disable quote handling for values.--no-escape, -e: Disable escape sequence handling for values.--indented-multiline-value, -m: Allow values to continue on indented lines.--preserve-key-leading-whitespace, -w: Preserve leading whitespace in keys.
Input/output types:
| input | output |
|---|---|
| string | record |
Examples
Converts ini formatted string to record
> '[foo]
a=1
b=2' | from ini
╭─────┬───────────╮
│ │ ╭───┬───╮ │
│ foo │ │ a │ 1 │ │
│ │ │ b │ 2 │ │
│ │ ╰───┴───╯ │
╰─────┴───────────╯Disable escaping to keep backslashes literal
> '[start]
file=C:\Windows\System32\xcopy.exe' | from ini --no-escape
╭───────┬──────────────────────────────────────────╮
│ │ ╭──────┬───────────────────────────────╮ │
│ start │ │ file │ C:\Windows\System32\xcopy.exe │ │
│ │ ╰──────┴───────────────────────────────╯ │
╰───────┴──────────────────────────────────────────╯Disable quote handling to keep quote characters
> '[foo]
bar="quoted"' | from ini --no-quote
╭─────┬────────────────────╮
│ │ ╭─────┬──────────╮ │
│ foo │ │ bar │ "quoted" │ │
│ │ ╰─────┴──────────╯ │
╰─────┴────────────────────╯Allow values to continue on indented lines
> '[foo]
bar=line one
line two' | from ini --indented-multiline-value
╭─────┬────────────────────╮
│ │ ╭─────┬──────────╮ │
│ foo │ │ bar │ line one │ │
│ │ │ │ line two │ │
│ │ ╰─────┴──────────╯ │
╰─────┴────────────────────╯Preserve leading whitespace in keys
> '[foo]
key=value' | from ini --preserve-key-leading-whitespace
╭─────┬───────────────────╮
│ │ ╭───────┬───────╮ │
│ foo │ │ key │ value │ │
│ │ ╰───────┴───────╯ │
╰─────┴───────────────────╯