Won't format files that don't end in `.nu`
Nobody has claimed this yet.
- 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:
- Have nu file without the
.nufile extension such asmy-command - Run
nufmt my-command - 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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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