github.com/x-motemen/ghq@v1.6.1/misc/bash/_ghq (about)

     1  function _ghq () {
     2    local cur prev words cword
     3    _init_completion || return
     4  
     5    case $cword in
     6    1)
     7      COMPREPLY=( $(compgen -W "get list" -- $cur) );;
     8    2)
     9      case $prev in
    10      get)
    11    	  COMPREPLY=( $(compgen -W "$(ghq list --unique)" -- $cur) );;
    12      list)
    13    	  COMPREPLY=( $(compgen -W "$(ghq list)" -- $cur) );;
    14      esac;;
    15    *)
    16      COMPREPLY=( $(compgen -W "$(ls)" -- $cur) );;
    17    esac
    18  }
    19  
    20  complete -F _ghq ghq