nushell / nushell/nufmt

Alternative specification for pipe formatting

Open
#60 13 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
Rust
Stars
230
Forks
40
Avg merge
15h 30m
Merged PRs (30d)
1

Description

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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading docs/specification.md, especially the “Sensible, default and features” section, and compare its current pipeline example with the proposed formatting. Review the issue’s comment thread for any decisions; done should mean that the alternative pipe placement and indentation behavior is agreed on and reflected in the formatter’s documented or implemented output.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
cli, tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.