I have implemented some perl scripts and in some cases i have to pass some command line args into my program.Usability perspective i have decided to add some bash completion script
into my project.But now i am stuck on where to put my script to work it as expected.Please let me know where can i put my bash completion script
Custom Perl Scripts location
C:\scripts\tool\bin\ktools.pl
also add bin
path to the system variable.
I have put my auto complete scripts in
C:\scripts\tool\bin\etc\bash_completion.d\ktools\foo
Bash Completion Script
_foo()
{
local cur prev opts
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"
opts="--help --verbose --version"
if [[ ${cur} == -* ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
return 0
fi
}
complete -F _foo ktools
Command should be auto suggested when user type ktools -- + press tab
in command line or git bash.