From 1a618fb24b01a0f393ccd82d55c4d8058bdeaf5c Mon Sep 17 00:00:00 2001 From: Eric Paris Date: Wed, 21 Feb 2018 07:50:56 -0800 Subject: [PATCH] Do not add a space after a single flag completion (#625) --- bash_completions.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/bash_completions.go b/bash_completions.go index 1d955ac..897ed2c 100644 --- a/bash_completions.go +++ b/bash_completions.go @@ -136,6 +136,12 @@ __%[1]s_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"