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

한 가지 패턴은 꽤 많은 옵션이 -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 -/

완성된 디자인을 가장 잘 변경하는 방법에 대한 단계별 옵션이나 팁의 예가 공개되어 있습니까?

관련 정보