nufmt
nufmt copied to clipboard
Alternative specification for pipe formatting
The specification.md describes the default formatting for pipelines to be a wall of lines.
def "apply to" [
file: path
modification: closure
] {
$file
| path expand
| open --raw
| from toml
| do $modification
| save --force $file
}
In the nushell discord fdncred mentioned how this creates issues with copy pasting code to the terminal on windows. Because of this I would like to suggest alternative formatting & indenting:
def "apply to" [
file: path
modification: closure
] {
$file |
path expand |
open --raw |
from toml |
do $modification |
save --force $file
}
This python style indenting still showcases that a pipeline is continued, despite that the pipe symbol is not at the start of the line.