From 9b4d25b7e9fe964d9674427c7a9181144cceb706 Mon Sep 17 00:00:00 2001 From: Eric Paris Date: Mon, 29 Jan 2018 21:23:24 -0600 Subject: [PATCH] Do not add a space after a single flag completion --- bash_completions.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/bash_completions.go b/bash_completions.go index c19fe7a0..7b7e0604 100644 --- a/bash_completions.go +++ b/bash_completions.go @@ -136,6 +136,12 @@ __handle_reply() if declare -F __ltrim_colon_completions >/dev/null; then __ltrim_colon_completions "$cur" fi + + # If there is only 1 completion and it is a flag with an = it will be completed + # but we don't want a space after the = + if [[ "${#COMPREPLY[@]}" -eq "1" ]] && [[ $(type -t compopt) = "builtin" ]] && [[ "${COMPREPLY[0]}" == --*= ]]; then + compopt -o nospace + fi } # The arguments should be in the form "ext1|ext2|extn"