aboutsummaryrefslogtreecommitdiffstats
path: root/commands/cd.go
diff options
context:
space:
mode:
authorRobin Jarry <robin@jarry.cc>2023-12-22 15:51:14 +0100
committerRobin Jarry <robin@jarry.cc>2024-01-17 11:52:59 +0100
commit3622f7a99e91bfe38eab9e91dc982aafa00fe211 (patch)
tree071af82a070719d2b4f46dca430a892941f70214 /commands/cd.go
parent765761c5bf49799e7d74535b9727062c869fc358 (diff)
downloadaerc-3622f7a99e91bfe38eab9e91dc982aafa00fe211.tar.gz
cd: fix completion of folders with a space
Folders that contain spaces are surrounded by quotes. They can never end with '/'. Hence they are never returned in the completion results. Update CompletePath with an additional onlyDirs argument to take care of this before quotes are inserted. Fixes: abe228b14d97 ("commands: use completion from go-opt") Fixes: https://todo.sr.ht/~rjarry/aerc/204 Reported-by: Bence Ferdinandy <bence@ferdinandy.com> Signed-off-by: Robin Jarry <robin@jarry.cc> Tested-by: Bence Ferdinandy <bence@ferdinandy.com>
Diffstat (limited to 'commands/cd.go')
-rw-r--r--commands/cd.go13
1 files changed, 1 insertions, 12 deletions
diff --git a/commands/cd.go b/commands/cd.go
index d2dc5310..cd206c3c 100644
--- a/commands/cd.go
+++ b/commands/cd.go
@@ -3,7 +3,6 @@ package commands
import (
"errors"
"os"
- "strings"
"git.sr.ht/~rjarry/aerc/app"
"git.sr.ht/~rjarry/aerc/lib/xdg"
@@ -24,17 +23,7 @@ func (ChangeDirectory) Aliases() []string {
}
func (*ChangeDirectory) CompleteTarget(arg string) []string {
- completions := CompletePath(arg)
-
- var dirs []string
- for _, c := range completions {
- // filter out non-directories
- if strings.HasSuffix(c, "/") {
- dirs = append(dirs, c)
- }
- }
-
- return dirs
+ return CompletePath(arg, true)
}
func (cd ChangeDirectory) Execute(args []string) error {