mirror of
https://github.com/fish-shell/fish-shell.git
synced 2025-03-27 14:45:13 +08:00
wildcard: Check trailing components against
Forward-port of c31e194120b36360864511c341e368408cd300c2, Revert of 6823f5e3374f00f43e9d20a4db12d63e0bc5da84, Fixes #10205
This commit is contained in:
parent
96caee837c
commit
f7c9538fb0
@ -667,8 +667,10 @@ mod expander {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if !self.flags.contains(ExpandFlags::FOR_COMPLETIONS) {
|
if !self.flags.contains(ExpandFlags::FOR_COMPLETIONS) {
|
||||||
// Trailing slash and not accepting incomplete, e.g. `echo /xyz/`. Insert this file, we already know it exists!
|
// Trailing slash and not accepting incomplete, e.g. `echo /xyz/`. Insert this file after checking it exists.
|
||||||
self.add_expansion_result(base_dir.to_owned());
|
if waccess(base_dir, F_OK) == 0 {
|
||||||
|
self.add_expansion_result(base_dir.to_owned());
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// Trailing slashes and accepting incomplete, e.g. `echo /xyz/<tab>`. Everything is added.
|
// Trailing slashes and accepting incomplete, e.g. `echo /xyz/<tab>`. Everything is added.
|
||||||
|
@ -11,6 +11,11 @@ touch ./b/file.txt
|
|||||||
|
|
||||||
set dirs ./a ./b
|
set dirs ./a ./b
|
||||||
echo $dirs/*.txt # CHECK: ./b/file.txt
|
echo $dirs/*.txt # CHECK: ./b/file.txt
|
||||||
|
echo */foo/
|
||||||
|
# CHECKERR: checks/wildcard.fish (line {{\d+}}): No matches for wildcard '*/foo/'. See `help wildcards-globbing`.
|
||||||
|
# CHECKERR: echo */foo/
|
||||||
|
# CHECKERR: ^~~~~^
|
||||||
|
|
||||||
|
|
||||||
cd $oldpwd
|
cd $oldpwd
|
||||||
rm -Rf $dir
|
rm -Rf $dir
|
||||||
|
Loading…
x
Reference in New Issue
Block a user