autocomplete - Get autocompletion list in bash variable -
i'm working big software project many build targets. when typing make <tab> <tab>
shows on 1000 possible make targets. want bash script filters targets rules. therefore have list of make targets in bash variable.
make_targets=$(???) [do make_targets] make $make_targets
it best if wouldn't have change project.
how can such list?
@yuyichao created function autocomplete output:
comp() { comp_line="$*" comp_words=("$@") comp_cword=${#comp_words[@]} ((comp_cword--)) comp_point=${#comp_line} comp_wordbreaks='"'"'><=;|&(:" # don't thing real autocompletion script rely on # following 2 vars, on principle ~~~ lol. comp_type=9 comp_key=9 _command_offset 0 echo ${compreply[@]} }
just run comp make ''
results, , can manipulate that. example:
$ comp make '' test foo clean
Comments
Post a Comment