I have a function like this:
p() { cd ~/Clients/$1/Projects/$2; }
Then I can type:
p "Client here" "Project here"
and he accepts me:
~/Clients/Client here/Projects/Project here
Nothing special happens here. But how can I implement autocomplete for this function? I managed to get autocomplete for the first argument (clients):
_p() { _files -W ~/Clients -/; }
compdef _p p
But how do I autofill the second argument (projects)? It should be autocompleted from a client-based folder:
~/Clients/$1/Projects
Hope someone can help! :-)
source
share