mirror of
https://github.com/nushell/nushell.git
synced 2026-11-26 03:25:39 +08:00
## Description
With `dc-glob` on, `glob ...`, `glob .../*` and `glob .../**` returned
`[]`. `ls`, `du`, `open` and external arguments already expand `...` to
`../..` on both backends, and so does `glob` on the legacy backend.
`run_dc_glob` expanded `~` but not n-dots.
`glob` now expands n-dots in the literal components at the start of the
pattern, up to the first component with glob syntax. Legacy does the
same with its literal prefix. Past that point `...` is a name, so
`*/...` is unchanged. The expansion runs before `glob` guesses the walk
depth, so `.../*` walks exactly like `../../*`.
## User-facing changes (Release notes)
### Before and after
Run from `a/b/c` with a `file.txt` in the temp root, `a`, `a/b` and
`a/b/c`, dc-glob on in both binaries. Before is main 4e65e6311. Paths
are relative to the temp root.
| pattern | before | after |
|---|---|---|
| `glob ...` | `[]` | `[a]` |
| `glob .../*.txt` | `[]` | `[a/file.txt]` |
| `glob .../**` | `[]` | `[a/b, a/b/c]` |
| `glob .../**/*.txt` | `[]` | `[a/b/c/file.txt, a/b/file.txt,
a/file.txt]` |
| `glob ./.../*.txt` | `[]` | `[a/file.txt]` |
| `glob ....` | `[]` | `[.]` |
`.../**` lists only directories, as `ls .../**` does on both backends
and `glob ../**` does with dc-glob.
- With the experimental `dc-glob` option, `glob` expands n-dots such as
`...` (`../..`) and `....` (`../../..`), as `ls` and the legacy `glob`
do.
## Additional notes
closes #19256. This fixes the `...` and `.../*` rows of that issue's
script. The rows that still differ there come from dc-glob's syntax (no
wax `<x:n,m>` repeats, `{a,b}` braces, a trailing `**` lists
directories) and aren't changed here and probably won't be supported in
the future. Being compliant with wax syntax is a non-goal.
nu-path
This crate takes care of path handling in Nushell, such as canonicalization and component expansion, as well as other path-related utilities.