zsh-workers
 help / color / mirror / code / Atom feed
From: doron.behar@gmail.com
To: zsh-workers@zsh.org
Subject: [PATCH 01/25] Add variables for all commands and options.
Date: Sat, 26 May 2018 18:06:10 +0300	[thread overview]
Message-ID: <20180526150634.15683-2-doron.behar@gmail.com> (raw)
In-Reply-To: <20180526150634.15683-1-doron.behar@gmail.com>

From: Doron Behar <doron.behar@gmail.com>

---
 Completion/Unix/Command/_luarocks | 178 ++++++++++++++++++++++++++++++
 1 file changed, 178 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..753fdb381
--- /dev/null
+++ b/Completion/Unix/Command/_luarocks
@@ -0,0 +1,178 @@
+#compdef luarocks
+
+local general_options=(
+	'(--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:'
+	'--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)"}'
+)
+# SYNOPSIS: /usr/bin/luarocks [--server=<server> | --only-server=<server>] [--tree=<tree>] [VAR=VALUE]... <command> [<argument>] 
+local 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_rockspect[Write a template for a rockspec file]'
+)
+
+# `build` command receives as an argument a .rockspec file, or external rock and afterwards a version
+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 option_deps_mode='--deps-mode=[How to handle dependencies. Four modes are supported:MODE:_luarocks_build_deps_mode'
+local build_command_options=(
+	"${make_command_options[@]}"
+	'--only-deps[Installs only the dependencies of the rock]'
+	$option_deps_mode
+)
+_luarocks_build_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
+}
+
+# `config` command sets a flag in the format VAR=VALUE
+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]'
+)
+
+# `doc` command ... TODO: what kind of argument it receives
+local doc_command_options=(
+	'--home[Open the home page of project]'
+	'--list[List documentation files only]'
+)
+
+# `download` command receives an argument of an 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:_luarocks_architecture'
+)
+_luarocks_architecture(){
+}
+
+# `help` command receives an argument of an internal command
+
+# `install` command receives the same argument as the build command and it accepts the same options as well
+
+# `lint` command receives an argument of a rockspec file
+
+# `list` command 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]'
+)
+
+# `make` command receives an argument of a rockspec file
+# it's options were already described above.
+
+# `new_version` command receives an argument a .rockspec file, or external rock and afterwards a version and optionally afterwards a URL
+local new_version_command_options=(
+	'--tag=[if no version is specified, this option'"'"'s argument is used instead]:TAG:__git_tag'
+)
+
+# `pack` command receives as an argument a .rockspec file, or external rock and afterwards a version
+
+# `path` command 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)]'
+)
+
+# `purge` command receives only options, --tree is mandatory, --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
+)
+
+
+# `remove` command receives as an argument a name of a locally installed rock
+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
+)
+
+# `search` command receives as an argument only a 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]'
+)
+
+# `show` command receives as an argument only an 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]'
+)
+
+# `unpack` command receives as an argument a rock package or an external rock and afterwards a version
+local unpack_command_options=(
+	'--force[Unpack files even if the output directory already exists]'
+)
+
+# `upload` command receives as an argument a rockspec file with .src.rock extension
+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]'
+)
+
+# `write_rockspec` command 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:_luarocks_write_rockspec_homepage'
+	'--lua-version=[Supported Lua versions]:LUA_VER:_luarocks_version' 
+	'--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]:_luarocks_write_rockspec_lib'
+)
+_luarocks_write_rockspec_lib(){
+}
+# TODO
+_luarocks_version(){
+	_values -s , 
+}
-- 
2.17.0


  reply	other threads:[~2018-05-26 15:07 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-26 15:06 [PATCH 00/25] *** Add completion for luarocks *** doron.behar
2018-05-26 15:06 ` doron.behar [this message]
2018-05-26 15:06 ` [PATCH 02/25] Remove architecture related option completion doron.behar
2018-05-26 15:06 ` [PATCH 03/25] Add marker style comments doron.behar
2018-05-26 15:06 ` [PATCH 04/25] Remove variables and use their contents directly doron.behar
2018-05-26 15:06 ` [PATCH 05/25] Add curcontext case for every subcommand doron.behar
2018-05-26 15:06 ` [PATCH 06/25] Use better naming scheme for common helpers doron.behar
2018-05-26 15:06 ` [PATCH 07/25] Write better sub commands comments doron.behar
2018-05-26 15:06 ` [PATCH 08/25] Add helpers section doron.behar
2018-05-26 15:06 ` [PATCH 09/25] Make *all* helpers functions begin with __luarocks doron.behar
2018-05-26 15:06 ` [PATCH 10/25] Write all simple sub commands completions doron.behar
2018-05-26 15:06 ` [PATCH 11/25] General internal conventions sync doron.behar
2018-05-26 15:06 ` [PATCH 12/25] Finish helper `__luarocks_lua_versions` doron.behar
2018-05-26 15:06 ` [PATCH 13/25] General cleanup doron.behar
2018-05-26 15:06 ` [PATCH 14/25] Finish `_luarocks_doc` and `_luarocks_config` doron.behar
2018-05-26 15:06 ` [PATCH 15/25] Expand __luarocks_rock_version so it accpets args doron.behar
2018-05-26 15:06 ` [PATCH 16/25] Finish completions for purge and new_version doron.behar
2018-05-26 15:06 ` [PATCH 17/25] Write a better comment for last TODO doron.behar
2018-05-26 15:06 ` [PATCH 18/25] Make cache policy function safer doron.behar
2018-05-26 15:06 ` [PATCH 19/25] Fix git tag completion by autoloading _git doron.behar
2018-05-26 15:06 ` [PATCH 20/25] Use a generic sub command completer doron.behar
2018-05-26 15:06 ` [PATCH 21/25] Use 2 spaces instead of tabs doron.behar
2018-05-26 15:06 ` [PATCH 22/25] Use +functions[] for all helpers doron.behar
2018-05-26 15:06 ` [PATCH 23/25] Improve `___luarocks_installed_rocks_cache_policy` doron.behar
2018-05-26 15:06 ` [PATCH 24/25] Consider `--tree` when searching installed rocks doron.behar
2018-05-26 15:06 ` [PATCH 25/25] Consider `--tree` in versions completion doron.behar
2018-05-26 15:37 ` [PATCH 00/25] *** Add completion for luarocks *** Eitan Adler
2018-05-26 16:09   ` Doron Behar

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180526150634.15683-2-doron.behar@gmail.com \
    --to=doron.behar@gmail.com \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).