source: trunk/project-meta/project-meta.bash_completion @ 300

Last change on this file since 300 was 185, checked in by g7moreau, 7 years ago
  • Add bash completion to project-meta
File size: 680 bytes
Line 
1# bash completion for project-meta
2
3_project-meta() {
4   local cur prev
5
6   COMPREPLY=()
7   #_get_comp_words_by_ref cur prev
8   cur="${COMP_WORDS[COMP_CWORD]}"
9   prev="${COMP_WORDS[COMP_CWORD-1]}"
10
11   if [[ "$cur" == '-*' || $COMP_CWORD -gt 1 ]]
12   then
13      COMPREPLY=($(compgen -W "$(project-meta  help|grep "^ project-meta ${COMP_WORDS[1]}" | sed -e 's/[\[]/\n/g;'|grep -- '^-'|cut -f 1 -d ']'|cut -f 1 -d ' '|sed -e 's/|/ /g;'|xargs echo -n)" -- "$cur"))
14   else
15      COMPREPLY=($(compgen -W "$($(which project-meta || echo /usr/bin/project-meta) help|grep '^ project-meta'|awk '{print $2}'|xargs echo -n)" -- "$cur"))
16   fi
17
18   } && complete -F _project-meta project-meta
Note: See TracBrowser for help on using the repository browser.