How to remove trailing slash from ZSH’s _files results?

20 Views Asked by At

I’m trying to create an autocompletion rule for a function that take an existing directory which should be located in a specific directory as an argument.

VENVS_PATH="${ZDOTDIR:-$HOME}/.pyvenv"

compdef _venv_completion venv_activate
compdef '_files -W "${VENVS_PATH}" -/' venv_activate

This works, however when I’m typing venv_activate and hit TAB, Zsh suggest the right directories but with trailing slashes:

$ venv_activate
Dir1/  Dir2/

Is there a way to remove them without calling an external program?

0

There are 0 best solutions below