zsh _arguments は徐々に表示オプションを完了します。

zsh _arguments は徐々に表示オプションを完了します。

現在、以下の完成機能があります(追加項目を除く)。

_arguments \
  '-check[do a check]' \
  '-play[play a specific song]:songnumber' \
  '-test.n=[run test specified number of times]:n' \
  '-test.dir=[run test in a specific working dir]:dir: _path_files -/' \
  '-test.v[run tests verbose]' \
  '-log[delete all log files]' \
  '*:inputfiles: _files'

ラベルを押すと、次のような印刷物が生成されます。

pseyfert@robusta:~ > program -⇥
option:
-check     -- do a check
-log       -- delete all log files
-play      -- play a specific song
-test.dir  -- run test in a specific working dir
-test.n    -- run test specified number of times
-test.v    -- run tests verbose

1つのパターンは、かなり多くのオプションが-test.私が一般的に興味のないオプションで始まるということです。したがって、思い出せないオプションを見つけると、ブロック全体が-test.わずかにスパムのように感じます。私は次のようにオプションを印刷物にグループ化することを好みます。

pseyfert@robusta:~ > program -⇥
option:
-check     -- do a check
-log       -- delete all log files
-play      -- play a specific song
-test.     -- test options

その後、-test.次の内容を公開してください。

pseyfert@robusta:~ > program -test.⇥
option:
-test.dir  -- run test in a specific working dir
-test.n    -- run test specified number of times
-test.v    -- run tests verbose

オプションの後にマイナス記号を使用すると、正しい方向を見つけることができることに気づきました。

_arguments \
  '-check[do a check]' \
  '-play[play a specific song]:songnumber' \
  '-log[delete all log files]' \
  '-test.-[test options]:testopts: _testopts' \
  '*:inputfiles: _files'

これにより、末尾にスペースが追加されず、-test.スペースが「続行オプション」として解釈されなくなります。私にとって不足しているのは機能です_testopts。私はそれを再利用したいのですが、その後に引用符_argumentsが必要です。説明をどのように入れるのか、上記の他の機能をどのように進めるのかわかりません。--test._values_path_files -/

完成したデザインを最適に変更する方法に関するステップバイステップのオプションやヒントの例が公開されていますか?

ベストアンサー1

おすすめ記事