Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
[PATCH 1/1] Squashed commit of the following:
- X-seq: zsh-workers 42858
- From: doron.behar@xxxxxxxxx
- To: zsh-workers@xxxxxxx
- Subject: [PATCH 1/1] Squashed commit of the following:
- Date: Sat, 26 May 2018 19:14:03 +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=piBiqzTxwu2JWOjtGid0+YHuk843AyS17g7kINzG5qA=; b=W4WSrRbcRD6RMDudyeFLgDxcx7cM+j29jjZe11b2qByWsEoAqL7ckAJ3U5KDNV4Svs B1/zY3cRZYBmqoyA0PSDvzPYTISKwUKB4ji8C85kj6k/MGgNdO1uUzgSpL7aWsOdxHE5 aQnprgZ8o8BzqXB4tsi01bkVod7fgQbyrsLrb6vVCjykNQgRHh8Q1IFAtroRfv8t9KcX olDMApt/JoKQkayZtkflCn7+wU2PBLhEcV/6IqPlYUi28TR7NUrjmD/iGZkqrJ+qhRqQ Zci2zbXmywAxAlMuK+OF95VQrS7MZ0+65RkM0Cl3RhnbLU7WxkdI+OTwc+L3LAJ1ruHD K8hQ==
- In-reply-to: <20180526161403.4860-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: <20180526161403.4860-1-doron.behar@gmail.com>
From: Doron Behar <doron.behar@xxxxxxxxx>
commit bc61113afd451d11f07c1c44dafb992cc134a960
Author: Doron Behar <doron.behar@xxxxxxxxx>
Date: Sat May 26 17:37:20 2018 +0300
Consider `--tree` in versions completion.
commit 8c727a34edb3f892bbf75427d15fa71f62344b3e
Author: Doron Behar <doron.behar@xxxxxxxxx>
Date: Sat May 26 17:30:59 2018 +0300
Consider `--tree` when searching installed rocks.
commit c9eb6832e617fddb5aafc26b55cd30630a18959e
Author: Doron Behar <doron.behar@xxxxxxxxx>
Date: Sat May 26 11:12:41 2018 +0300
Improve `___luarocks_installed_rocks_cache_policy`.
Handle multiple trees when evaluating installed rocks cache validity -
both system wide and user's.
commit 78d444d0393e9da28ccbb783c88c22d6e784352d
Author: Doron Behar <doron.behar@xxxxxxxxx>
Date: Mon May 14 23:51:56 2018 +0300
Use +functions[] for all helpers.
commit 27a5a8e9bb0b2fbafc3c6a4d7fb2928b4cd6d927
Author: Doron Behar <doron.behar@xxxxxxxxx>
Date: Mon May 14 23:34:51 2018 +0300
Use 2 spaces instead of tabs.
commit 063240718e07154af4d0242a6611ea8fcfd4bffd
Author: Doron Behar <doron.behar@xxxxxxxxx>
Date: Mon Apr 30 18:54:02 2018 +0300
Use a generic sub command completer.
commit 12310709ab3c1d4fad464355f10e32ec44193777
Author: Doron Behar <doron.behar@xxxxxxxxx>
Date: Mon Apr 30 13:48:39 2018 +0300
Fix git tag completion by autoloading _git
commit 7e71ce226dc18bfb3e72610d33633ff20857f8c4
Author: Doron Behar <doron.behar@xxxxxxxxx>
Date: Mon Apr 30 13:48:03 2018 +0300
Make cache policy function safer.
Add TODO for using zstyle for manifest files location when checking when
they were last modified.
commit 8b6aafc444fa128ca2dce277cc3a1579788446a2
Author: Doron Behar <doron.behar@xxxxxxxxx>
Date: Sat Apr 28 12:06:49 2018 +0300
Write a better comment for last TODO.
I don't know how to finish it.
commit fc48b1583366a672a2ec011029505e3b4a3e7711
Author: Doron Behar <doron.behar@xxxxxxxxx>
Date: Sat Apr 28 12:05:08 2018 +0300
Finish completions for purge and new_version.
commit 2791ee20ccc6ff35817f43baad0d311c0026bab1
Author: Doron Behar <doron.behar@xxxxxxxxx>
Date: Sat Apr 28 11:15:48 2018 +0300
Expand __luarocks_rock_version so it accpets args.
Write `_luarocks_write_rockspec`.
commit f16c723a4fa5f5a9e07cb75a62eaeeea17b472c1
Author: Doron Behar <doron.behar@xxxxxxxxx>
Date: Sat Apr 28 10:22:30 2018 +0300
Finish `_luarocks_doc` and `_luarocks_config`.
commit 783783b76d149b47adecf0d11bb7db122477f51b
Author: Doron Behar <doron.behar@xxxxxxxxx>
Date: Sat Apr 28 10:21:07 2018 +0300
General cleanup.
commit 2e4771d6fd5937069ee25fe6edb92c6b7d6afaed
Author: Doron Behar <doron.behar@xxxxxxxxx>
Date: Sat Apr 28 10:20:32 2018 +0300
Finish helper `__luarocks_lua_versions`.
commit 5daeade7690b04d7f102e5b144a6ba85fd3ee7d3
Author: Doron Behar <doron.behar@xxxxxxxxx>
Date: Fri Apr 27 23:11:54 2018 +0300
General internal conventions sync.
commit e29115c07ee8cecfa4ddaeb2f8e09a1bc0ae9e74
Author: Doron Behar <doron.behar@xxxxxxxxx>
Date: Fri Apr 27 22:56:59 2018 +0300
Write all simple sub commands completions.
Most importantly, write (using `_cache_` functions) helpers that
complete installed rocks with their descriptions generated with
`luarocks show <>`.
commit 6c35e70c9af278621a2bc3067358071d0185a08d
Author: Doron Behar <doron.behar@xxxxxxxxx>
Date: Fri Apr 27 22:52:50 2018 +0300
Make *all* helpers functions begin with __luarocks.
commit 45a71b968e0e6b60503a3d1e3ffb9bad0ab79500
Author: Doron Behar <doron.behar@xxxxxxxxx>
Date: Thu Apr 26 12:48:18 2018 +0300
Add helpers section.
commit 751eed19b4e0fb787d28f1a9ea996c296341200d
Author: Doron Behar <doron.behar@xxxxxxxxx>
Date: Wed Apr 25 21:25:47 2018 +0300
Write better sub commands comments.
commit 6a47db186ceaf74e6bb1ac6aaa7cef602ecfd3bc
Author: Doron Behar <doron.behar@xxxxxxxxx>
Date: Wed Apr 25 19:40:07 2018 +0300
Use better naming scheme for common helpers.
Rename `_luarocks_build_deps_mode` to `__luarocks_deps_mode`.
Rename `_luarocks_version` to `__luarocks_version`.
commit 92164093db3f4df6e8b3cdd40e218998c169b2ed
Author: Doron Behar <doron.behar@xxxxxxxxx>
Date: Wed Apr 25 19:32:54 2018 +0300
Add curcontext case for every subcommand.
Thanks `src/_android`!
commit dd42a18a26fb54ccab00646b6becede2a405036a
Author: Doron Behar <doron.behar@xxxxxxxxx>
Date: Wed Apr 25 19:00:13 2018 +0300
Remove variables and use their contents directly.
commit 11b039b124b7fa2bdda9b419f29f4766f121f25f
Author: Doron Behar <doron.behar@xxxxxxxxx>
Date: Wed Apr 25 15:27:31 2018 +0300
Add marker style comments.
commit 60f9055538ee1063e7139c084ebb9dd504a73346
Author: Doron Behar <doron.behar@xxxxxxxxx>
Date: Wed Apr 25 15:02:22 2018 +0300
Remove architecture related option completion.
commit 78f677f2d7a19e50b68a6cf12e4b297aa64f4a95
Author: Doron Behar <doron.behar@xxxxxxxxx>
Date: Wed Apr 25 13:02:40 2018 +0300
Add variables for all commands and options.
---
Completion/Unix/Command/_luarocks | 560 ++++++++++++++++++++++++++++++
1 file changed, 560 insertions(+)
create mode 100644 Completion/Unix/Command/_luarocks
diff --git a/Completion/Unix/Command/_luarocks b/Completion/Unix/Command/_luarocks
new file mode 100644
index 000000000..a02bd06b5
--- /dev/null
+++ b/Completion/Unix/Command/_luarocks
@@ -0,0 +1,560 @@
+#compdef luarocks
+
+# {{{ helper: luarocks commands
+(( $+functions[__luarocks_command] )) ||
+__luarocks_command(){
+ local -a commands=(
+ build:'Build/compile a rock'
+ config:'Query information about the LuaRocks configuration'
+ doc:'Show documentation for an installed rock'
+ download:'Download a specific rock file from a rocks server'
+ help:'Help on commands'
+ install:'Install a rock'
+ lint:'Check syntax of a rockspec'
+ list:'List currently installed rocks'
+ make:'Compile package in current directory using a rockspec'
+ new_version:'Auto-write a rockspec for a new version of a rock'
+ pack:'Create a rock, packing sources or binaries'
+ path:'Return the currently configured package path'
+ purge:'Remove all installed rocks from a tree'
+ remove:'Uninstall a rock'
+ search:'Query the LuaRocks servers'
+ show:'Show information about an installed rock'
+ unpack:'Unpack the contents of a rock'
+ upload:'Upload a rockspec to the public rocks repository'
+ write_rockspec:'Write a template for a rockspec file'
+ )
+ _describe -t commands 'command' commands "$@"
+}
+# }}}
+# {{{ 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'
+ 'one:use only the current tree (possibly set with --tree)'
+ 'order:use trees based on order (use the current tree and all trees below it on the rocks_trees list)'
+ 'none:ignore dependencies altogether'
+ )
+ _describe 'dependencies mode' modes
+}
+# }}}
+# {{{ 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
+ if [[ ! "${words[$i]}" =~ '^-' ]]; then
+ case "$1" in
+ "external_or_local")
+ if [[ ! -f "${words[$i]}" ]]; then
+ _message -e "version for external rock ${words[$i]}"
+ return
+ else
+ _message -e "version for local rock ${words[$i]}"
+ fi
+ ;;
+ "installed")
+ # TODO: actually complete versions of installed rocks using the cache
+ # How does luarocks handles multiple versions of the same package?
+ # If anybody knows, please write something beautiful here
+ tree="$2"
+ if [[ -z "${tree}" ]]; then
+ _message -e "version for installed rock ${words[$i]}"
+ else
+ _message -e "version for installed rock ${words[$i]} on tree ${tree}"
+ fi
+ return
+ ;;
+ "new_version")
+ if [[ -f "${words[$i]}" ]]; then
+ _message -e "new version for rock ${words[$i]}"
+ return
+ fi
+ ;;
+ "new_rock")
+ _message -e "version for new rock ${words[$i]}"
+ return
+ ;;
+ esac
+ fi
+ i=$(( i + 1 ))
+ done
+}
+# }}}
+# {{{ 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(){
+ # the number of seconds since 1970-01-01 the manifest files were modified
+ local user_manifest_last_date_modified="$(date -r ${HOME}/.luarocks/lib/luarocks/rocks-5.3/manifest +%s 2>/dev/null)"
+ local system_manifest_last_date_modified="$(date -r /usr/lib/luarocks/rocks-5.3/manifest +%s 2>/dev/null)"
+ # the number of seconds since 1970-01-01 the cache file was modified
+ local cache_last_date_modified="$(date -r $1 +%s 2>/dev/null)"
+ if [[ ! -z ${cache_last_date_modified} && ! -z ${user_manifest_last_date_modified} && ! -z ${system_manifest_last_date_modified} ]]; then
+ # if the manifest file is newer then the cache:
+ if [ ${user_manifest_last_date_modified} -ge ${cache_last_date_modified} ] || [ ${system_manifest_last_date_modified} -ge ${cache_last_date_modified} ]; then
+ (( 1 ))
+ else
+ (( 0 ))
+ fi
+ else
+ (( 1 ))
+ fi
+}
+# }}}
+# {{{ helper: installed rocks
+(( $+functions[__luarocks_installed_rocks] )) ||
+__luarocks_installed_rocks(){
+ # This function optionally recieves one argument of the tree in which
+ # installed rocks are searched for. If this argument is used, the installed
+ # rocks which will be completed by this function will not use the cache which
+ # is valid only for installed rocks on default trees like /usr/lib/luarocks
+ # and ~/.luarocks
+ local tree="$1"
+ if [[ -z ${tree} ]]; then
+ local update_policy
+ zstyle -s ":completion:${curcontext}:" cache-policy update_policy
+ if [[ -z "$update_policy" ]]; then
+ zstyle ":completion:${curcontext}:" cache-policy ___luarocks_installed_rocks_cache_policy
+ fi
+ if _cache_invalid luarocks_installed_list; then
+ rocks_list=($(luarocks list --porcelain))
+ _store_cache luarocks_installed_list rocks_list
+ else
+ _retrieve_cache luarocks_installed_list
+ fi
+ if [[ -z ${rocks_list} ]]; then
+ _message -r "no installed rocks"
+ return
+ fi
+ if _cache_invalid luarocks_installed_names; then
+ rocks_names=()
+ for i in {1.."${#rocks_list[@]}"..4}; do
+ rocks_names+=("${rocks_list[$i]}")
+ done
+ _store_cache luarocks_installed_names rocks_names
+ else
+ _retrieve_cache luarocks_installed_names
+ fi
+ if _cache_invalid luarocks_installed_versions; then
+ rocks_versions=()
+ for i in {2.."${#rocks_list[@]}"..4}; do
+ rocks_versions+=("${rocks_list[$i]}")
+ done
+ _store_cache luarocks_installed_versions rocks_versions
+ else
+ _retrieve_cache luarocks_installed_versions
+ fi
+ if _cache_invalid luarocks_installed_descriptions; then
+ rocks_descriptions=()
+ for i in {1.."${#rocks_names[@]}"}; do
+ name_version_description="$(luarocks show ${rocks_names[$i]} 2>/dev/null | head -2 | tail -1)"
+ total_length=${#name_version_description}
+ garbage_length="$((${#rocks_names[$i]} + ${#rocks_versions[$i]} + 5))"
+ description="${name_version_description[${garbage_length},${total_length}]}"
+ rocks_descriptions+=("${description}")
+ done
+ _store_cache luarocks_installed_descriptions rocks_descriptions
+ else
+ _retrieve_cache luarocks_installed_descriptions
+ fi
+ if _cache_invalid luarocks_installed_names_and_descriptions; then
+ rocks_names_and_descriptions=()
+ for i in {1.."${#rocks_names[@]}"}; do
+ name_and_description=${rocks_names[$i]}:${rocks_descriptions[$i]}
+ rocks_names_and_descriptions+=(${name_and_description})
+ done
+ else
+ _store_cache luarocks_installed_names_and_descriptions rocks_names_and_descriptions
+ fi
+ else
+ rocks_list=($(luarocks --tree="${tree}" list --porcelain 2> /dev/null))
+ if [[ -z ${rocks_list} ]]; then
+ _message "no installed rocks in the specified tree"
+ return
+ fi
+ rocks_names=()
+ for i in {1.."${#rocks_list[@]}"..4}; do
+ rocks_names+=("${rocks_list[$i]}")
+ done
+ rocks_versions=()
+ for i in {2.."${#rocks_list[@]}"..4}; do
+ rocks_versions+=("${rocks_list[$i]}")
+ done
+ rocks_descriptions=()
+ for i in {1.."${#rocks_names[@]}"}; do
+ name_version_description="$(luarocks show ${rocks_names[$i]} 2> /dev/null | head -2 | tail -1)"
+ total_length=${#name_version_description}
+ garbage_length="$((${#rocks_names[$i]} + ${#rocks_versions[$i]} + 5))"
+ description="${name_version_description[${garbage_length},${total_length}]}"
+ rocks_descriptions+=("${description}")
+ done
+ rocks_names_and_descriptions=()
+ for i in {1.."${#rocks_names[@]}"}; do
+ name_and_description=${rocks_names[$i]}:${rocks_descriptions[$i]}
+ rocks_names_and_descriptions+=(${name_and_description})
+ done
+ fi
+ _describe 'installed rocks' rocks_names_and_descriptions
+}
+# }}}
+# {{{ helper: rocks wrapper
+# Used to complete one or more of the followings:
+# - .rockspec file
+# - .src.rock file
+# - external rock
+(( $+functions[__luarocks_rock] )) ||
+__luarocks_rock(){
+ local -a alts=()
+ while [[ $# -gt 0 ]]; do
+ arg="$1"
+ case "$arg" in
+ (rockspec)
+ alts+=(':rock file:{_files -g "*.rockspec"}')
+ shift 1
+ continue
+ ;;
+ (rockpack)
+ alts+=(':rock file:{_files -g "*.src.rock"}')
+ shift 1
+ continue
+ ;;
+ (external)
+ alts+=(':external rock:')
+ shift 1
+ continue
+ ;;
+ (installed)
+ tree="$2"
+ alts+=(":local rock:{__luarocks_installed_rocks ${tree}}")
+ if [[ -z "${tree}" ]]; then
+ shift
+ else
+ shift 2
+ fi
+ continue
+ ;;
+ esac
+ shift
+ continue
+ done
+ _alternative ${alts[@]}
+}
+# }}}
+# {{{ helper: git tags
+(( $+functions[__luarocks_git_tags] )) ||
+__luarocks_git_tags(){
+ autoload +X _git
+ local _git_def="$(whence -v _git)"
+ . ${_git_def##* }
+ type __git_tags &> /dev/null
+ if [[ $? != 1 ]]; then
+ __git_tags
+ fi
+}
+# }}}
+
+# {{{ `build` command
+# arguments:
+# - must: .rockspec file / external rock
+# - optional: version (only when chossing external rock)
+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"}'
+)
+local build_command_options=(
+ "${make_command_options[@]}"
+ '--only-deps[Installs only the dependencies of the rock]'
+ $option_deps_mode
+)
+(( $+functions[_luarocks_build] )) ||
+_luarocks_build(){
+ _arguments -A "-*" \
+ "${build_command_options[@]}" \
+ '1: :{__luarocks_rock "rockspec" "external"}' \
+ '2:: :{__luarocks_rock_version "external_or_local"}'
+}
+# }}}
+# {{{ `config` command
+# arguments:
+# - must: option
+local config_command_options=(
+ '--lua-incdir[Path to Lua header files]'
+ '--lua-libdir[Path to Lua library files]'
+ '--lua-ver[Lua version (in major.minor format)]'
+ '--system-config[Location of the system config file]'
+ '--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[@]}"
+}
+# }}}
+# {{{ `doc` command
+# arguments:
+# - must: installed rock
+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[@]}" \
+ '1: :{__luarocks_rock "installed" '"${opt_args[--tree]}"'}'
+}
+# }}}
+# {{{ `download` command
+# arguments:
+# - must: external only rockspec
+local download_command_options=(
+ '--all[Download all files if there are multiple matches]'
+ '--source[Download .src.rock if available]'
+ '--rockspec[Download .rockspec if available]'
+ '--arch=[Download rock for a specific architecture]:ARCH:'
+)
+(( $+functions[_luarocks_download] )) ||
+_luarocks_download(){
+ _arguments -A "-*" \
+ "${download_command_options[@]}" \
+ '1: :{__luarocks_rock "external"}' \
+ '2:: :{__luarocks_rock_version "external_or_local"}'
+}
+# }}}
+# {{{ `help` command
+# arguments:
+# must: luarocks sub command
+(( $+functions[_luarocks_help] )) ||
+_luarocks_help(){
+ _arguments '1: :__luarocks_command'
+}
+# }}}
+# {{{ `install` command
+# arguments:
+# - 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
+}
+# }}}
+# {{{ `lint` command
+# arguments:
+# - must: rockspec file (first and last)
+(( $+functions[_luarocks_lint] )) ||
+_luarocks_lint(){
+ _arguments '1::{__luarocks_rock "rockspec"}'
+}
+# }}}
+# {{{ `list` command
+# NOTE: receives only options
+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[@]}"
+}
+# }}}
+# {{{ `make` command
+# arguments:
+# - optional: rockspec file
+# NOTE: it's options were already described above.
+(( $+functions[_luarocks_make] )) ||
+_luarocks_make(){
+ _arguments '1:: :{__luarocks_rock "rockspec"}'
+}
+# }}}
+# {{{ `new_version` command
+# arguments:
+# - optional: .rockspec file / external rock
+# - optional: version (unless a --tag was given)
+# - optional: URL
+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[@]}" \
+ '1:: :{__luarocks_rock "external" "rockspec"}' \
+ '2:: :{__luarocks_rock_version "external_or_local"}' \
+ '3:: :_urls'
+}
+# }}}
+# {{{ `pack` command
+# arguments:
+# - must: .rockspec file / external rock
+# - optional: version
+(( $+functions[_luarocks_pack] )) ||
+_luarocks_pack(){
+ _luarocks_build
+}
+# }}}
+# {{{ `path` command
+# NOTE: receives only options
+local path_command_options=(
+ '--bin[Adds the system path to the output]'
+ '--append[Appends the paths to the existing paths]'
+ '--lr-path[Exports the Lua path (not formatted as shell command)]'
+ '--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[@]}"
+}
+# }}}
+# {{{ `purge` command
+# NOTE: receives only options yet --tree is mandatory
+# NOTE: --force can be used only in conjunction with --old-versions
+local option_force='--force[Force removing old versions when]'
+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[@]}"
+}
+# }}}
+# {{{ `remove` command
+# arguments:
+# - must: locally installed rock
+# - optional: version
+local option_force_fast='--force-fast[works like --force but doesn'"'"'t reports forced removals]'
+local remove_command_options=(
+ $option_deps_mode
+ $option_force
+ $option_force_fast
+)
+(( $+functions[_luarocks_remove] )) ||
+_luarocks_remove(){
+ _arguments -A "-*" \
+ "${remove_command_options[@]}" \
+ '1: :{__luarocks_rock "installed" '"${opt_args[--tree]}"'}' \
+ '2:: :{__luarocks_rock_version "installed" '"${opt_args[--tree]}"'}'
+}
+# }}}
+# {{{ `search` command
+# arguments:
+# - must: string as a search query
+local search_command_options=(
+ '--source[Return only rockspecs and source rocks]'
+ '--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[@]}" \
+ '*:SEARCH QUERY:'
+}
+# }}}
+# {{{ `show` command
+# arguments:
+# - must: installed rock
+local show_command_options=(
+ '--home[home page of project]'
+ '--modules[all modules provided by this package as used by require()]'
+ '--deps[packages this package depends on]'
+ '--rockspec[the full path of the rockspec file]'
+ '--mversion[the package version]'
+ '--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[@]}" \
+ "1: :{__luarocks_rock 'installed' "${opt_args[--tree]}"}"
+}
+# }}}
+# {{{ `unpack` command
+# arguments:
+# - must: rockpack file / external rock
+# - optional: version (only when chossing external rock)
+local unpack_command_options=(
+ '--force[Unpack files even if the output directory already exists]'
+)
+(( $+functions[_luarocks_unpack] )) ||
+_luarocks_unpack(){
+ _arguments \
+ "${unpack_command_options[@]}" \
+ '1: :{__luarocks_rock "rockpack" "external"}'
+}
+# }}}
+# {{{ `upload` command
+# arguments:
+# - must: rockspec file
+local upload_command_options=(
+ '--skip-pack[Do not pack and send source rock]'
+ '--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[@]}" \
+ '1: :{__luarocks_rock "rockspec"}'
+}
+# }}}
+# {{{ `write_rockspec` command
+# arguments:
+# - optional: name
+# - optional: version
+# - optional: URL / PATH
+# receives as an argument a name and a version with optionally a URL/PATH
+local write_rockspec_command_options=(
+ '--output=[Write the rockspec with the given filename]:FILE:_files'
+ '--license=[A license string, ]:LICENSE:{_message -e "write a license string such as "MIT/X11" or "GNU GPL v3"}'
+ '--summary=[A short one-line description summary]:SUMMARY_TEXT:{_message -e "write a short summary of the rock"}'
+ '--detailed=[A longer description string]:DETAILED_TEXT:{_message -e "write a detailed description of the rock"}'
+ '--homepage=[Project homepage]:URL:_urls'
+ '--lua-version=[Supported Lua versions]:LUA_VER:__luarocks_lua_versions'
+ '--rockspec-format=[Rockspec format version, such as "1.0" or "1.1"]:VER: '
+ '--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[@]}" \
+ '1:: :{_message "new rock name"}' \
+ '2:: :{__luarocks_rock_version "new_rock"}' \
+ '3:: :_urls'
+}
+# }}}
+
+# The real thing
+_arguments -C \
+ '(--server --only-server)--server=[Fetch rocks/rockspecs from this server]:HOST:_hosts' \
+ '(--server --only-server)--only-server=[Fetch rocks/rockspecs from this server only]:HOST:_hosts' \
+ '--only-sources=[Restrict downloads to paths matching the given URL]:URL:_urls' \
+ '--tree=[Which tree to operate on]:TREE:{_files -/}' \
+ '--local[Use the tree in the user'"'"'s home directory]' \
+ '--verbose[Display verbose output of commands executed]' \
+ '--timeout=[Timeout on network operations]:SECONDS:{_message "timeout (seconds)"}' \
+ '1: :__luarocks_command' \
+ '*::arg:->args'
+
+case "$state" in
+ (args)
+ curcontext="${curcontext%:*:*}:luarocks_${words[1]}:"
+ # check if a command with a defined completion was typed
+ type _luarocks_${words[1]} &> /dev/null
+ if [[ $? != 1 ]]; then
+ _luarocks_${words[1]}
+ fi
+esac
--
2.17.0
Messages sorted by:
Reverse Date,
Date,
Thread,
Author