#StackBounty: #zsh #autocomplete zsh: complete hostnames and files in given directory

Bounty: 500

I have a script myscript which takes two arguments:

  1. hostname
  2. directory

How can I write my own zsh completion, so that whenever I do


mysript <TAB>

it completes from my hosts list (ie same as ssh does) and when I do


mysript host1 <TAB>

it completes from directories in /home/martin/test/ ?



Get this bounty!!!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.