Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions modules/formats/from-env.nu
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,12 @@ def "from env" []: string -> record {
| get column1
| parse "{key}={value}"
| update value {
str trim -c '"' | # unquote values
str replace -a "\\n" "\n" # replace `\n` with newline char
str replace -a "\\r" "\r" # replace `\r` with carriage return
str replace -a "\\t" "\t" # replace `\t` with tab
str trim # Trim whitespace between value and inline comments
| str trim -c '"' # unquote double-quoted values
| str trim -c "'" # unquote single-quoted values
| str replace -a "\\n" "\n" # replace `\n` with newline char
| str replace -a "\\r" "\r" # replace `\r` with carriage return
| str replace -a "\\t" "\t" # replace `\t` with tab
}
| transpose -r -d
}
Loading