我正在尝试为 zsh(或 bash)编写一个自定义自动完成脚本,该脚本具有以斜杠开头的选项。
例如:MyCommand /foo=bar.txt /yolo=test /final=4
我一直在尝试使用 zsh 帮助_arguments
程序,但它没有用:
#compdef MyCommand
_MyCommand()
{
local curcontext="$curcontext" state line
typeset -A opt_args
_arguments \
'/foo=:foo:_files'
}
_MyCommand "$@"
但是当我用它替换/
它--
时效果很好。
我怎样才能做到这一点?