nushell / nushell/nushell

`glob` in `watch` doesn't match `{}`

Open
#14,172 5 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

A:glob category:inconsistent-behavior
Dominant language
Rust
Stars
40.5k
Forks
2.3k
Avg merge
1d 19h
Merged PRs (30d)
85

Description

Describe the bug

When I try to watch for file changes across multiple directries, but not all, or specify the file type it doesn't seem to work. I'm used to using {}. This works with glob command as expected i.e. glob **/*.{rs,toml} works fine, however watch . --glob="**/*{rs,toml}" {} shows Matches glob: false.

I've looked through watch -h but there don't seem to be any indications that its --glob should behave differently than glob. Am I missing something, or is this a bug?

In https://github.com/nushell/nushell/issues/10782 this question was asked (after the issue was closed) but I don't see an answer.

How to reproduce

Run watch . --glob=<path> -v {} where <path> includes {}.

Expected behavior

watch . --glob="**/*{rs,toml}" {} would react to changes in all files listed by glob "**/*{rs,toml}"

Configuration
key value
version 0.99.1
major 0
minor 99
patch 1
branch
commit_hash
build_os linux-x86_64
build_target x86_64-unknown-linux-gnu
rust_version rustc 1.81.0 (eeb90cda1 2024-09-04) (built from a source tarball)
cargo_version cargo 1.81.0 (2dbb1af80 2024-08-20)
build_time 1980-01-01 00:00:00 +00:00
build_rust_channel release
allocator mimalloc
features default, sqlite, trash
installed_plugins

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 the watch command's --glob entry point and compare its matching behavior with the glob command using **/*{rs,toml}. Reproduce with watch . --glob="**/*{rs,toml}" {} and verify that brace patterns match the same files as glob; the issue is done when changes to those files trigger the command.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.