nufmt icon indicating copy to clipboard operation
nufmt copied to clipboard

Alternative specification for pipe formatting

Open CabalCrow opened this issue 9 months ago • 13 comments

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.

CabalCrow avatar May 26 '24 18:05 CabalCrow