feat!: remove recursive dir support for setlocal (#2415)
* feat!: remove recursive dir support for `setlocal` * Update version in man page * Update `CHANGELOG.md`
This commit is contained in:
1 parent
941866b62f
commit
374ae19cb2
7 files changed
+17
-88
No files matched your search
+1
-29
@@ -312,34 +312,6 @@ func matchShellFile(s string) (matches []compMatch, longest string) {
|
||||
return
|
||||
}
|
||||
|
||||
func matchSetlocalDir(s string) (matches []compMatch, longest string) {
|
||||
matches, longest = matchFile(s, true, cmdEscape, cmdUnescape)
|
||||
if len(matches) == 0 {
|
||||
return
|
||||
}
|
||||
|
||||
trimSep := func(path string) string {
|
||||
return strings.TrimSuffix(path, string(filepath.Separator))
|
||||
}
|
||||
|
||||
trimSepEsc := func(path string) string {
|
||||
return cmdEscape(trimSep(cmdUnescape(path)))
|
||||
}
|
||||
|
||||
// add separate matches for path and recursive path
|
||||
tmp := make([]compMatch, 0, len(matches)*2)
|
||||
for _, match := range matches {
|
||||
trimmedMatch := compMatch{trimSep(match.name), trimSepEsc(match.result)}
|
||||
tmp = append(tmp, trimmedMatch, match)
|
||||
}
|
||||
matches = tmp
|
||||
|
||||
if longest != s {
|
||||
longest = trimSepEsc(longest)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func matchExec(s string) (matches []compMatch, longest string) {
|
||||
var words []string
|
||||
for p := range strings.SplitSeq(envPath, string(filepath.ListSeparator)) {
|
||||
@@ -442,7 +414,7 @@ func completeCmd(s string) (matches []compMatch, longest string) {
|
||||
}
|
||||
case "setlocal":
|
||||
if len(f) == 2 {
|
||||
matches, longest = matchSetlocalDir(f[1])
|
||||
matches, longest = matchCmdFile(f[1], true)
|
||||
break
|
||||
}
|
||||
if len(f) == 3 {
|
||||
|
||||
Reference in new issue
Block a user