Thursday, September 29, 2016

-bash: _get_comp_words_by_ref: command not found

When you try to use Spring Boot CLI shell completion, you might encounter the following error:

$ . ~/.sdkman/candidates/springboot/current/shell-completion/bash/spring
$ spring -bash: _get_comp_words_by_ref: command not found
-bash: [: -ne: unary operator expected

$

Install 'bash-completion' as follows:

brew install bash-completion
brew tap homebrew/completions

And add the following to '.bash_profile':

if [ -f $(brew --prefix)/etc/bash_completion ]; then
  . $(brew --prefix)/etc/bash_completion
fi

Apply the configuration as follows:

source ~/.bash_profile

and now you can see completion candidates as follows:

$ spring
grab       init       jar        shell      uninstall  war      
help       install    run        test       version  
$

References:
http://docs.spring.io/spring-boot/docs/current-SNAPSHOT/reference/htmlsingle/#getting-started-installing-the-cli
http://davidalger.com/development/bash-completion-on-os-x-with-brew/

No comments:

Post a Comment