nushell / nushell/nufmt

Won't format files that don't end in `.nu`

Open
#73 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Describe the bug

I have a shell command written in nu that has a shebang at the top. I cannot get nufmt to format this file unless I rename it to *.nu or I use the --stdin flag.

https://github.com/nushell/nufmt/blob/35962223fbd4c1a924b4ccfb8c7ad81fe2863b86/src/main.rs#L319-L322

Steps To Reproduce

Steps to reproduce the behavior:

  1. Have nu file without the .nu file extension such as my-command
  2. Run nufmt my-command
  3. Observe error "warning: no Nushell files found under the given path(s)⏎"
Expected behavior

I expect nufmt to format the file because I specified the file on the CLI.

Environment

Please run rustc --version and paste the result.

[user@system:~]$ rustc --version
rustc 1.91.1 (ed61e7d7e 2025-11-07)

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 at src/main.rs around lines 319-322 and inspect how explicitly provided paths are selected. Reproduce the issue with an extensionless Nushell file by running nufmt on it, then verify that the specified file is formatted without requiring a .nu suffix or --stdin.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
cli
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.