zsh-workers
 help / color / mirror / Atom feed
* PATCH: cleanup inappropriate use of {...} specs with _arguments or _alternative
@ 2021-08-27 12:06 Oliver Kiddle
  0 siblings, 0 replies; only message in thread
From: Oliver Kiddle @ 2021-08-27 12:06 UTC (permalink / raw)
  To: Zsh workers

The use of the curly bracket action form with _arguments and
_alternative is only rarely useful but there's a couple of functions
where it is extensively applied for no real purpose.

This patch cleans that up.

Oliver

diff --git Completion/Unix/Command/_gcore Completion/Unix/Command/_gcore
index 913ef25ca..a31a81267 100644
--- Completion/Unix/Command/_gcore
+++ Completion/Unix/Command/_gcore
@@ -55,7 +55,7 @@ case $OSTYPE in
       '-v[report progress on the dump as it proceeds]' \
       '-b+[specify maximum size of core file]:size (MiB): ' \
       '(-c)-o+[write core file to specified file]:file:_files' \
-      '(-o)-c+[specify format of core file name]:format:{_message "%%N\:program name, %%U\:uid, %%P\:pid, %%T\:time stamp"}' \
+      '(-o)-c+[specify format of core file name]:format (%%N\:program name, %%U\:uid, %%P\:pid, %%T\:time stamp)' \
       '1:pid:_pids'
   ;;
   *)
diff --git Completion/Unix/Command/_luarocks Completion/Unix/Command/_luarocks
index 0915765dc..42169c22a 100644
--- Completion/Unix/Command/_luarocks
+++ Completion/Unix/Command/_luarocks
@@ -34,8 +34,8 @@ local option_deps_modes='--deps-mode=[specify how to handle dependencies]:mode:_
 
 local rockspec_options=(
   '--license=[specify a license string]:license (e.g. "MIT/X11" or "GNU GPL v3")'
-  '--summary=[a short one-line description summary]:summary:{_message -e "short summary of the rock"}'
-  '--detailed=[a longer description string]:detailed_text:{_message -e "detailed description of the rock"}'
+  '--summary=[a short one-line description summary]:summary'
+  '--detailed=[a longer description string]:detailed description'
   '--homepage=[project homepage]:URL:_urls'
   '--lua-versions=[specify supported Lua versions]:lua version:_sequence compadd - 5.{1,2,3,4}'
   '--rockspec-format=[rockspec format version, such as "1.0" or "1.1"]:VER: '
@@ -321,7 +321,7 @@ __luarocks_rock(){
         continue
         ;;
       (rockpack)
-        alts+=(':rock file:{_files -g "*.src.rock(-.)"}')
+        alts+=( ':rock file:_files -g "*.src.rock(-.)"' )
         shift 1
         continue
         ;;
@@ -332,7 +332,7 @@ __luarocks_rock(){
         ;;
       (installed)
         tree="$2"
-        alts+=(":local rock:{__luarocks_installed_rocks ${tree}}")
+        alts+=(":local rock: __luarocks_installed_rocks ${tree}")
         if [[ -z "${tree}" ]]; then
           shift
         else
@@ -364,7 +364,7 @@ __luarocks_git_tags(){
 local make_command_options=(
   '--pack-binary-rock[produce a .rock file with the contents of compilation inside the current directory instead of installing it]'
   '--keep[do not remove previously installed versions of the rock after building a new one]'
-  '--branch=[override the `source.branch` field in the loaded rockspec]:NAME:{_message "branch name"}'
+  '--branch=[override the `source.branch` field in the loaded rockspec]:branch name'
 )
 local build_command_options=(
   "${make_command_options[@]}"
@@ -375,8 +375,8 @@ local build_command_options=(
 _luarocks_build(){
   _arguments -A "-*" \
     "${build_command_options[@]}" \
-    '1: :{__luarocks_rock "rockspec" "external"}' \
-    '2:: :{__luarocks_rock_version "external_or_local"}'
+    '1: : __luarocks_rock "rockspec" "external"' \
+    '2:: : __luarocks_rock_version "external_or_local"'
 }
 # arguments:
 # - must: option
@@ -402,7 +402,7 @@ local doc_command_options=(
 _luarocks_doc(){
   _arguments \
     "${doc_command_options[@]}" \
-    "1: :{__luarocks_rock installed ${opt_args[--tree]}}"
+    "1: : __luarocks_rock installed ${opt_args[--tree]}"
 }
 # arguments:
 # - must: external only rockspec
@@ -416,14 +416,14 @@ local download_command_options=(
 _luarocks_download(){
   _arguments -A "-*" \
     "${download_command_options[@]}" \
-    '1: :{__luarocks_rock "external"}' \
-    '2:: :{__luarocks_rock_version "external_or_local"}'
+    '1: : __luarocks_rock "external"' \
+    '2:: : __luarocks_rock_version "external_or_local"'
 }
 # arguments:
 # must: luarocks sub command
 (( $+functions[_luarocks_help] )) ||
 _luarocks_help(){
-  _arguments '1: :__luarocks_command'
+  _arguments '1: : __luarocks_command'
 }
 
 (( $+functions[_luarocks_init] )) ||
@@ -446,7 +446,7 @@ _luarocks_install(){
 # - must: rockspec file (first and last)
 (( $+functions[_luarocks_lint] )) ||
 _luarocks_lint(){
-  _arguments '1:: :{__luarocks_rock "rockspec"}'
+  _arguments '1:: : __luarocks_rock "rockspec"'
 }
 # arguments:
 # NOTE: receives only options
@@ -463,7 +463,7 @@ _luarocks_list(){
 # NOTE: it's options were already described above.
 (( $+functions[_luarocks_make] )) ||
 _luarocks_make(){
-  _arguments '1:: :{__luarocks_rock "rockspec"}'
+  _arguments '1:: : __luarocks_rock "rockspec"'
 }
 # arguments:
 # - optional: .rockspec file / external rock
@@ -476,8 +476,8 @@ local new_version_command_options=(
 _luarocks_new_version(){
   _arguments -A "-*" \
     "${new_version_command_options[@]}" \
-    '1:: :{__luarocks_rock "external" "rockspec"}' \
-    '2:: :{__luarocks_rock_version "external_or_local"}' \
+    '1:: : __luarocks_rock "external" "rockspec"' \
+    '2:: : __luarocks_rock_version "external_or_local"' \
     '3:: :_urls'
 }
 # arguments:
@@ -524,8 +524,8 @@ local remove_command_options=(
 _luarocks_remove(){
   _arguments -A "-*" \
     "${remove_command_options[@]}" \
-    "1: :{__luarocks_rock installed ${opt_args[--tree]}}" \
-    "2:: :{__luarocks_rock_version installed ${opt_args[--tree]}}"
+    "1: : __luarocks_rock installed ${opt_args[--tree]}" \
+    "2:: : __luarocks_rock_version installed ${opt_args[--tree]}"
 }
 # arguments:
 # - must: string as a search query
@@ -558,8 +558,8 @@ local show_command_options=(
 _luarocks_show(){
   _arguments \
     "${show_command_options[@]}" \
-    "1: :{__luarocks_rock installed "${opt_args[--tree]}"}" \
-    "2:: :{__luarocks_rock_version installed ${opt_args[--tree]}}"
+    "1: : __luarocks_rock installed "${opt_args[--tree]}"" \
+    "2:: : __luarocks_rock_version installed ${opt_args[--tree]}"
 }
 
 (( $+functions[_luarocks_test] )) ||
@@ -567,7 +567,7 @@ _luarocks_test(){
   _arguments $option_deps_modes \
     '--test-type=[specify the test suite type manually]:test suite type' \
     '--reset[regenerate files if they already exist]' \
-    '1:rockspec:__luarocks_rock' \
+    '1: : __luarocks_rock' \
     '*:arg'
 }
 
@@ -581,7 +581,7 @@ local unpack_command_options=(
 _luarocks_unpack(){
   _arguments \
     "${unpack_command_options[@]}" \
-    '1: :{__luarocks_rock "rockpack" "external"}'
+    '1: : __luarocks_rock "rockpack" "external"'
 }
 # arguments:
 # - must: rockspec file
@@ -595,7 +595,7 @@ local upload_command_options=(
 _luarocks_upload(){
   _arguments \
     "${upload_command_options[@]}" \
-    '1: :{__luarocks_rock "rockspec"}'
+    '1: : __luarocks_rock "rockspec"'
 }
 
 (( $+functions[_luarocks_which] )) ||
@@ -609,8 +609,8 @@ _luarocks_write_rockspec(){
     "${rockspec_options[@]}" \
     '--output=[write the rockspec with the given file]:file:_files' \
     '--tag=[specify tag to use. Will attempt to extract version number from it]:tag:__git_tag' \
-    '1:: :{_message "new rock name"}' \
-    '2:: :{__luarocks_rock_version "new_rock"}' \
+    '1::new rock name' \
+    '2:: : __luarocks_rock_version "new_rock"' \
     '3:: :_urls'
 }
 
diff --git Completion/Unix/Command/_pandoc Completion/Unix/Command/_pandoc
index 464859655..b0fff80d6 100644
--- Completion/Unix/Command/_pandoc
+++ Completion/Unix/Command/_pandoc
@@ -187,7 +187,7 @@ _arguments -s \
   '--shift-heading-level-by=[shift heading levels by specified number]:positive or negative integer: ' \
   '!--base-header-level=:number [1]:(1 2 3 4 5)' \
   '!--strip-empty-paragraphs[deprecated. Use the +empty_paragraphs extension instead]' \
-  '--indented-code-classes=[classes to use for indented code blocks]:class:{_message "Classes separated with ,"}' \
+  '--indented-code-classes=[classes to use for indented code blocks]:class list (comma-separated)' \
   '--default-image-extension=[specify a default extension to use when image paths/URLs have no extension]:extension: ' \
   '--file-scope[parse each file individually before combining for multifile documents]' \
   {\*-F+,\*--filter=}'[specify an executable to be used as a filter transforming the pandoc AST after the input is parsed and before the output is written]: :_pandoc_filter' \
@@ -209,7 +209,7 @@ _arguments -s \
   '--wrap=[determine how text is wrapped in the output (the source code, not the rendered version)]: :_pandoc_wrap ' \
   '--columns=[specify length of lines in characters]:length [72]' \
   {--toc,--table-of-contents}'[include an automatically generated table of contents]' \
-  '--toc-depth=[specify the number of section levels to include in the table of contents]:number:{_message -r "choose a number equals to or greater then 1"}' \
+  '--toc-depth=[specify the number of section levels to include in the table of contents]:number' \
   '--strip-comments[strip out HTML comments in the Markdown or Textile source]' \
   '--no-highlight[disables syntax highlighting for code blocks and inlines]' \
   '--highlight-style=[specifies the coloring style to be used in highlighted source code]:style|file:_pandoc_highlight_style' \
diff --git Completion/Unix/Command/_transmission Completion/Unix/Command/_transmission
index 9b7309fe2..a640f3dd7 100644
--- Completion/Unix/Command/_transmission
+++ Completion/Unix/Command/_transmission
@@ -65,9 +65,9 @@ local global_only_actions=(
 )
 # `torrent_add_options`: *options* that can be used only when *adding* a torrent
 local torrent_add_options=(
-  '(-C --no-incomplete-dir)'{-c+,--incomplete-dir=}'[when adding new torrents, store their contents in directory until the torrent is done]:dir:{_files -/}'
+  '(-C --no-incomplete-dir)'{-c+,--incomplete-dir=}'[when adding new torrents, store their contents in directory until the torrent is done]:directory:_directories'
   '(-c --incomplete-dir)'{-C,--no-incomplete-dir}'[don'"'"'t store incomplete torrents in a different directory]'
-  {-w+,--download-dir=}'[when used in conjunction with --add, set the new torrent'"'"'s download folder]:dir:{_files -/}'
+  {-w+,--download-dir=}"[when used in conjunction with --add, set the new torrent's download directory]:directory:_directories"
 )
 # `torrent_action_only_actions`: *actions* that can be specified only when explicitly selecting a specific set of torrents
 local torrent_action_only_actions=(
@@ -88,7 +88,7 @@ local torrent_action_only_actions=(
   {-r,--remove}'[remove the current torrent(s) without deleting the downloaded data]'
   {-rad,--remove-and-delete}'[remove the current torrent(s) and delete the downloaded data]'
   '--reannounce[reannounce the current torrent(s)]'
-  '--move[move the current torrents'"'"' data from their current locations to the specified directory]:{_files -/}'
+  "--move[move the current torrents' data from their current locations to the specified directory]:directory:_directories"
   {-sr+,--seedratio=}'[let the current torrent(s) seed until a specific ratio]:ratio'
   {-SR,--no-seedratio}'[let the current torrent(s) use the global seedratio settings]'
   {-hl,--honor-session}'[make the current torrent(s) honor the session limits]'


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-08-27 12:06 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-27 12:06 PATCH: cleanup inappropriate use of {...} specs with _arguments or _alternative Oliver Kiddle

zsh-workers

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://inbox.vuxu.org/zsh-workers

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V1 zsh-workers zsh-workers/ https://inbox.vuxu.org/zsh-workers \
		zsh-workers@zsh.org
	public-inbox-index zsh-workers

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.vuxu.org/vuxu.archive.zsh.workers


code repositories for the project(s) associated with this inbox:

	https://git.vuxu.org/mirror/zsh/

AGPL code for this site: git clone https://public-inbox.org/public-inbox.git