From 1dce092ac00e17f700864b80a3da061b5dc28285 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Mon, 19 Sep 2022 17:47:37 +0530 Subject: [PATCH] Add trailing spaces for bash completion --- tools/completion/bash.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tools/completion/bash.go b/tools/completion/bash.go index 92e940490..58357e307 100644 --- a/tools/completion/bash.go +++ b/tools/completion/bash.go @@ -16,7 +16,11 @@ func bash_output_serializer(completions []*Completions, shell_state map[string]s for _, mg := range completions[0].Groups { mg.remove_common_prefix() for _, m := range mg.Matches { - fmt.Fprintln(&output, "COMPREPLY+=("+utils.QuoteStringForSH(m.Word)+")") + w := m.Word + if !mg.NoTrailingSpace { + w += " " + } + fmt.Fprintln(&output, "COMPREPLY+=("+utils.QuoteStringForSH(w)+")") } } return []byte(output.String()), nil