Bash completion for names with ':' character.

This commit is contained in:
Adam Bozanich
2015-12-09 20:57:45 -08:00
parent 29cddf65b2
commit fe79245d1a
3 changed files with 14 additions and 3 deletions

View File

@ -34,7 +34,7 @@ COMPREPLY=( "hello" )
func TestBashCompletions(t *testing.T) {
c := initializeWithRootCmd()
cmdEcho.AddCommand(cmdTimes)
c.AddCommand(cmdEcho, cmdPrint, cmdDeprecated)
c.AddCommand(cmdEcho, cmdPrint, cmdDeprecated, cmdColon)
// custom completion function
c.BashCompletionFunction = bash_completion_func
@ -75,6 +75,7 @@ func TestBashCompletions(t *testing.T) {
check(t, str, "_cobra-test_echo")
check(t, str, "_cobra-test_echo_times")
check(t, str, "_cobra-test_print")
check(t, str, "_cobra-test_cmd__colon")
// check for required flags
check(t, str, `must_have_one_flag+=("--introot=")`)