Say someprogram needs only *.abc files as command line arguments. In terminal, when I do

$ someprogram <tab>

I'd like to only the *.abc files to be listed for tab auto-complete. How do I do that? The shell I use is zsh.

In bash this behaviour is achieved by complete -f -X '!*.abc' someprogram


List only *.abc files:

compctl -g '*.abc' someprogram

List folders, too:

compctl -/ -g '*.abc' someprogram
  • Great. It does the trick. – menteith Dec 16 '17 at 19:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.