Skip to content

fix let and ensure glob variables expand correctly in runtime and tests - #17596

Merged
fdncred merged 1 commit into
nushell:mainfrom
fdncred:fix_let_on_globs
Feb 21, 2026
Merged

fdncred merged 1 commit into
nushell:mainfrom
fdncred:fix_let_on_globs

Conversation

@fdncred

@fdncred fdncred commented Feb 18, 2026 •

Copy link
Copy Markdown
Contributor

This PR fixes how globs work with let.

Closes #7579

Release notes summary - What our users need to know

Globs now work at assignment time.

Before

❯ let g: glob = "*.toml"
❯ ls $g
Error: nu::shell::error

  × No matches found for DoNotExpand("*.toml")
   ╭─[entry #2:1:4]
 1 │ ls $g
   ·    ─┬
   ·     ╰── Pattern, file or folder not found
   ╰────
  help: no matches found

After

❯ let g: glob = "*.toml"
❯ ls $g
╭─#─┬────────name─────────┬─type─┬───size───┬──modified───╮
│ 0 │ Cargo.toml          │ file │ 11.09 kB │ 7 hours ago │
│ 1 │ Cross.toml          │ file │    666 B │ 2 years ago │
│ 2 │ rust-toolchain.toml │ file │    939 B │ 3 weeks ago │
│ 3 │ typos.toml          │ file │    627 B │ 3 weeks ago │
╰───┴─────────────────────┴──────┴──────────┴─────────────╯

Still working

❯ let g = "*.toml" | into glob
❯ ls $g
╭─#─┬────────name─────────┬─type─┬───size───┬──modified───╮
│ 0 │ Cargo.toml          │ file │ 11.09 kB │ 7 hours ago │
│ 1 │ Cross.toml          │ file │    666 B │ 2 years ago │
│ 2 │ rust-toolchain.toml │ file │    939 B │ 3 weeks ago │
│ 3 │ typos.toml          │ file │    627 B │ 3 weeks ago │
╰───┴─────────────────────┴──────┴──────────┴─────────────╯
❯ glob $g
╭───┬───────────────────────────────────────────────╮
│ 0 │ /home/fdncred/src/nushell/typos.toml          │
│ 1 │ /home/fdncred/src/nushell/Cargo.toml          │
│ 2 │ /home/fdncred/src/nushell/Cross.toml          │
│ 3 │ /home/fdncred/src/nushell/rust-toolchain.toml │
╰───┴───────────────────────────────────────────────╯
❯ ls ...(glob $g)
╭─#─┬─────────────────────name──────────────────────┬─type─┬───size───┬──modified───╮
│ 0 │ /home/fdncred/src/nushell/Cargo.toml          │ file │ 11.09 kB │ 7 hours ago │
│ 1 │ /home/fdncred/src/nushell/Cross.toml          │ file │    666 B │ 2 years ago │
│ 2 │ /home/fdncred/src/nushell/rust-toolchain.toml │ file │    939 B │ 3 weeks ago │
│ 3 │ /home/fdncred/src/nushell/typos.toml          │ file │    627 B │ 3 weeks ago │
╰───┴───────────────────────────────────────────────┴──────┴──────────┴─────────────╯

Tasks after submitting

@fdncred
fdncred merged commit c2f45cf into nushell:main Feb 21, 2026
16 checks passed
@fdncred
fdncred deleted the fix_let_on_globs branch February 21, 2026 15:55
@github-actions github-actions Bot added this to the v0.111.0 milestone Feb 21, 2026
astral-l pushed a commit to astral-l/nushell that referenced this pull request Feb 24, 2026
@fdncred fdncred added A:glob Behavior around file-system globbing with regular commands or `glob`. See also A:quoting/expansion notes:fixes Noted in "Bug fixes" section notes:ready Indicates Ready for Release notes labels Feb 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A:glob Behavior around file-system globbing with regular commands or `glob`. See also A:quoting/expansion notes:fixes Noted in "Bug fixes" section notes:ready Indicates Ready for Release notes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ls glob and glob glob behave differently.

1 participant