0

オプションの引数として--with-PROG=andを取るプログラムの補完を書きたいと思います。別のプログラムの 1 つかもしれません。多くの異なるプログラムがあるので、各プログラムのオプションを手動で書き出すことは避けたいと思います。私は次のことを試しました:--PROG-optionsPROG

#compdef hello

typeset -A opt_args
local context state line

_hello()
{
    typeset -a PROGS
    PROGS=('gcc' 'make')
    _arguments \
        '--with-'${^PROGS}'[path to PROG]:executable:_files' \
        '--'${^PROGS}'-options[PROG options]:string:'
}

出力:

$ hello --gcc-options
--make-options  --gcc-options  -- PROG  options                                                                                                                          
--with-make     --with-gcc     -- path to PROG

ただし、個々のオプションを別の行に配置PROGし、プログラム名に置き換えたいと思います。それを行う最善の方法は何ですか?

4

1 に答える 1