Skip to content

Won't format files that don't end in .nu #73

@dannyfritz

Description

@dannyfritz

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.

nufmt/src/main.rs

Lines 319 to 322 in 3596222

fn is_nu_file(entry: &DirEntry) -> bool {
entry.file_type().map(|ft| ft.is_file()).unwrap_or(false)
&& entry.path().extension().is_some_and(|ext| ext == "nu")
}

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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions