#!/bin/zsh

# install findutils if not already installed
if brew ls --versions findutils > /dev/null; then echo "installed" > /dev/null; else brew install findutils; fi

# load the modules for bash autompletion
autoload -U +X compinit && compinit
autoload -U +X bashcompinit && bashcompinit

{% for p in paths %}
f{{p.ind}}=$(gfind {{p.dest_path}} -mindepth 1 -type d -printf "%f ")
{% endfor %}

_gcliComplete()
{
    local cur=${COMP_WORDS[COMP_CWORD]}
    COMPREPLY=( $(compgen -W "{% for p in paths %} $f{{p.ind}} {% endfor %}" -- $cur) )
}

complete -F _gcliComplete gcli
