mirror of
https://github.com/caelestia-dots/cli.git
synced 2026-06-19 07:20:01 -05:00
fix: only match dirs when globs if a tail is given
This commit is contained in:
@@ -57,7 +57,10 @@ class ManifestEntry:
|
|||||||
glob_idx = max(i for i, part in enumerate(parts) if _GLOB_MAGIC.search(part))
|
glob_idx = max(i for i, part in enumerate(parts) if _GLOB_MAGIC.search(part))
|
||||||
pattern = str(Path(*parts[: glob_idx + 1]))
|
pattern = str(Path(*parts[: glob_idx + 1]))
|
||||||
tail = parts[glob_idx + 1 :]
|
tail = parts[glob_idx + 1 :]
|
||||||
return [Path(match, *tail) for match in sorted(glob.glob(pattern))]
|
matches = sorted(glob.glob(pattern))
|
||||||
|
if tail: # Only match dirs if a tail exists
|
||||||
|
matches = [match for match in matches if Path(match).is_dir()]
|
||||||
|
return [Path(match, *tail) for match in matches]
|
||||||
|
|
||||||
|
|
||||||
@dataclass(frozen=True)
|
@dataclass(frozen=True)
|
||||||
|
|||||||
Reference in New Issue
Block a user