Add trailing spaces for bash completion

This commit is contained in:
Kovid Goyal 2022-09-19 17:47:37 +05:30
parent 24c2d27eea
commit 1dce092ac0
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -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