save: fix path completion
Ignore option flags and prepend default-save-path if the current path is not absolute. Signed-off-by: Robin Jarry <robin@jarry.cc> Reviewed-by: Moritz Poldrack <moritz@poldrack.dev>
This commit is contained in:
parent
fc604b6679
commit
2fd9cef568
1 changed files with 9 additions and 0 deletions
|
@ -30,7 +30,16 @@ func (Save) Aliases() []string {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (Save) Complete(aerc *widgets.Aerc, args []string) []string {
|
func (Save) Complete(aerc *widgets.Aerc, args []string) []string {
|
||||||
|
_, optind, _ := getopt.Getopts(args, "fpa")
|
||||||
|
if optind < len(args) {
|
||||||
|
args = args[optind:]
|
||||||
|
}
|
||||||
path := strings.Join(args, " ")
|
path := strings.Join(args, " ")
|
||||||
|
defaultPath := aerc.Config().General.DefaultSavePath
|
||||||
|
if defaultPath != "" && !isAbsPath(path) {
|
||||||
|
path = filepath.Join(defaultPath, path)
|
||||||
|
}
|
||||||
|
path, _ = homedir.Expand(path)
|
||||||
return commands.CompletePath(path)
|
return commands.CompletePath(path)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue