Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
[PATCH 22/25] Use +functions[] for all helpers.
- X-seq: zsh-workers 42849
- From: doron.behar@xxxxxxxxx
- To: zsh-workers@xxxxxxx
- Subject: [PATCH 22/25] Use +functions[] for all helpers.
- Date: Sat, 26 May 2018 18:06:31 +0300
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references; bh=VTv/RgTMINAmcP9ahXxbNEFXec59KrFYS4TWbtzk0Ts=; b=dDeQKmKNKiZE3nCupoZmkqVgPc3jYTZr+zVvoZwz9YNelN83nti9gv8E4+IPDavX5j H1Tiwsj7dzLDfNKmBllcyVFEnGHXn8g8XVLryHlM39XLqX05v9lr4tbQeq5JGeIzQI5M 6VAZtjGS0rgtAx5BbshF2AKce9O/14Niu/N5RGw504EksVFdNFLFzACYpX72xxbRUz1N 2UwxR8ZitOZPZImWemr+zR8GOoUy11oB3+yOWTVr60GUhqjii7IX0OTtOymD24K0tOcg kRq+H3mk4we/WVyovJXL42+OYs6Z/X8MqyTl3Y3QwO8TP5K5Ji/Uh3DMrJ7GJWa+11q3 Ja8Q==
- In-reply-to: <20180526150634.15683-1-doron.behar@gmail.com>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- List-unsubscribe: <mailto:zsh-workers-unsubscribe@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <20180526150634.15683-1-doron.behar@gmail.com>
From: Doron Behar <doron.behar@xxxxxxxxx>
---
Completion/Unix/Command/_luarocks | 27 +++++++++++++++++++++++++++
1 file changed, 27 insertions(+)
diff --git a/Completion/Unix/Command/_luarocks b/Completion/Unix/Command/_luarocks
index 1dda38cad..cb42d1b36 100644
--- a/Completion/Unix/Command/_luarocks
+++ b/Completion/Unix/Command/_luarocks
@@ -1,6 +1,7 @@
#compdef luarocks
# {{{ helper: luarocks commands
+(( $+functions[__luarocks_command] )) ||
__luarocks_command(){
local -a commands=(
build:'Build/compile a rock'
@@ -28,6 +29,7 @@ __luarocks_command(){
# }}}
# {{{ helper: dependencies mode
local option_deps_mode='--deps-mode=[How to handle dependencies]:MODE:__luarocks_deps_mode'
+(( $+functions[__luarocks_deps_mode] )) ||
__luarocks_deps_mode(){
local modes=(
'all:use all trees from the rocks_trees list for finding dependencies'
@@ -39,6 +41,7 @@ __luarocks_deps_mode(){
}
# }}}
# {{{ helper: versions of an external rock or nothing for rockspec file
+(( $+functions[__luarocks_rock_version] )) ||
__luarocks_rock_version(){
local i=2
while [[ -n "${words[$i]}" ]]; do
@@ -76,11 +79,13 @@ __luarocks_rock_version(){
}
# }}}
# {{{ helper: lua versions
+(( $+functions[__luarocks_lua_versions] )) ||
__luarocks_lua_versions(){
_values -s , 5.3 5.2 5.1
}
# }}}
# {{{ helper: installed rocks cache policy
+(( $+functions[___luarocks_installed_rocks_cache_policy] )) ||
___luarocks_installed_rocks_cache_policy(){
# TODO enable the user to configure manifests file that will be checked here with zstyle
# the number of seconds since 1970-01-01 the manifest file was modified
@@ -100,6 +105,7 @@ ___luarocks_installed_rocks_cache_policy(){
}
# }}}
# {{{ helper: installed rocks
+(( $+functions[__luarocks_installed_rocks] )) ||
__luarocks_installed_rocks(){
local update_policy
zstyle -s ":completion:${curcontext}:" cache-policy update_policy
@@ -160,6 +166,7 @@ __luarocks_installed_rocks(){
# - .rockspec file
# - .src.rock file
# - external rock
+(( $+functions[__luarocks_rock] )) ||
__luarocks_rock(){
local -a alts=()
for arg in "$@"; do
@@ -182,6 +189,7 @@ __luarocks_rock(){
}
# }}}
# {{{ helper: git tags
+(( $+functions[__luarocks_git_tags] )) ||
__luarocks_git_tags(){
autoload +X _git
local _git_def="$(whence -v _git)"
@@ -207,6 +215,7 @@ local build_command_options=(
'--only-deps[Installs only the dependencies of the rock]'
$option_deps_mode
)
+(( $+functions[_luarocks_build] )) ||
_luarocks_build(){
_arguments -A "-*" \
"${build_command_options[@]}" \
@@ -225,6 +234,7 @@ local config_command_options=(
'--user-config[Location of the user config file]'
'--rock-trees[Rocks trees in useFirst the user tree, then the system tree]'
)
+(( $+functions[_luarocks_config] )) ||
_luarocks_config(){
_arguments "${config_command_options[@]}"
}
@@ -236,6 +246,7 @@ local doc_command_options=(
'--home[Open the home page of project]'
'--list[List documentation files only]'
)
+(( $+functions[_luarocks_doc] )) ||
_luarocks_doc(){
_arguments \
"${doc_command_options[@]}" \
@@ -251,6 +262,7 @@ local download_command_options=(
'--rockspec[Download .rockspec if available]'
'--arch=[Download rock for a specific architecture]:ARCH:'
)
+(( $+functions[_luarocks_download] )) ||
_luarocks_download(){
_arguments -A "-*" \
"${download_command_options[@]}" \
@@ -261,6 +273,7 @@ _luarocks_download(){
# {{{ `help` command
# arguments:
# must: luarocks sub command
+(( $+functions[_luarocks_help] )) ||
_luarocks_help(){
_arguments '1: :__luarocks_command'
}
@@ -270,6 +283,7 @@ _luarocks_help(){
# - must: .rockspec file / external rock
# - optional: version
# NOTE: it receives the same argument as the build command and it accepts the same options as well
+(( $+functions[_luarocks_install] )) ||
_luarocks_install(){
_luarocks_build
}
@@ -277,6 +291,7 @@ _luarocks_install(){
# {{{ `lint` command
# arguments:
# - must: rockspec file (first and last)
+(( $+functions[_luarocks_lint] )) ||
_luarocks_lint(){
_arguments '1::{__luarocks_rock "rockspec"}'
}
@@ -287,6 +302,7 @@ local list_command_options=(
'--outdated[List only rocks for which there is a higher version available in the rocks server]'
'--porcelain[Produce machine-friendly output]'
)
+(( $+functions[_luarocks_list] )) ||
_luarocks_list(){
_arguments "${list_command_options[@]}"
}
@@ -295,6 +311,7 @@ _luarocks_list(){
# arguments:
# - optional: rockspec file
# NOTE: it's options were already described above.
+(( $+functions[_luarocks_make] )) ||
_luarocks_make(){
_arguments '1:: :{__luarocks_rock "rockspec"}'
}
@@ -307,6 +324,7 @@ _luarocks_make(){
local new_version_command_options=(
'--tag=[if no version is specified, this option'"'"'s argument is used instead]:TAG:__luarocks_git_tags'
)
+(( $+functions[_luarocks_new_version] )) ||
_luarocks_new_version(){
_arguments -A "-*" \
"${new_version_command_options[@]}" \
@@ -319,6 +337,7 @@ _luarocks_new_version(){
# arguments:
# - must: .rockspec file / external rock
# - optional: version
+(( $+functions[_luarocks_pack] )) ||
_luarocks_pack(){
_luarocks_build
}
@@ -332,6 +351,7 @@ local path_command_options=(
'--lr-cpath[Exports the Lua cpath (not formatted as shell command)]'
'--lr-bin[Exports the system path (not formatted as shell command)]'
)
+(( $+functions[_luarocks_path] )) ||
_luarocks_path(){
_arguments "${path_command_options[@]}"
}
@@ -344,6 +364,7 @@ local purge_command_options=(
'--old-versions[Keep the highest-numbered version of each rock and remove the other ones]'
$option_force
)
+(( $+functions[_luarocks_purge] )) ||
_luarocks_purge(){
_arguments "${purge_command_options[@]}"
}
@@ -358,6 +379,7 @@ local remove_command_options=(
$option_force
$option_force_fast
)
+(( $+functions[_luarocks_remove] )) ||
_luarocks_remove(){
_arguments -A "-*" \
"${remove_command_options[@]}" \
@@ -373,6 +395,7 @@ local search_command_options=(
'--binary[Return only pure Lua and binary rocks (rocks that can be used with the "install" command without requiring a C toolchain)]'
'--all[List all contents of the server that are suitable to this platform, do not filter by name]'
)
+(( $+functions[_luarocks_search] )) ||
_luarocks_search(){
_arguments \
"${search_command_options[@]}" \
@@ -391,6 +414,7 @@ local show_command_options=(
'--rock-tree[local tree where rock is installed]'
'--rock-dir[data directory of the installed rock]'
)
+(( $+functions[_luarocks_show] )) ||
_luarocks_show(){
_arguments \
"${show_command_options[@]}" \
@@ -404,6 +428,7 @@ _luarocks_show(){
local unpack_command_options=(
'--force[Unpack files even if the output directory already exists]'
)
+(( $+functions[_luarocks_unpack] )) ||
_luarocks_unpack(){
_arguments \
"${unpack_command_options[@]}" \
@@ -418,6 +443,7 @@ local upload_command_options=(
'--api-key=[Give it an API key]:KEY:{_message "api key"}'
'--force[Replace existing rockspec if the same revision of a module already exists]'
)
+(( $+functions[_luarocks_upload] )) ||
_luarocks_upload(){
_arguments \
"${upload_command_options[@]}" \
@@ -441,6 +467,7 @@ local write_rockspec_command_options=(
'--tag=[Tag to use. Will attempt to extract version number from it]:TAG:__git_tag'
'--lib=[A comma-separated list of libraries that C files need to link to]:'
)
+(( $+functions[_luarocks_write_rockspec] )) ||
_luarocks_write_rockspec(){
_arguments -A "-*" \
"${write_rockspec_command_options[@]}" \
--
2.17.0
Messages sorted by:
Reverse Date,
Date,
Thread,
Author