From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 96 invoked by alias); 26 May 2018 15:07:18 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: List-Unsubscribe: X-Seq: 42833 Received: (qmail 12262 invoked by uid 1010); 26 May 2018 15:07:18 -0000 X-Qmail-Scanner-Diagnostics: from mail-wr0-f196.google.com by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.99.2/21882. spamassassin: 3.4.1. Clear:RC:0(209.85.128.196):SA:0(-3.7/5.0):. Processed in 3.040751 secs); 26 May 2018 15:07:18 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-3.7 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_PASS,T_DKIM_INVALID autolearn=ham autolearn_force=no version=3.4.1 X-Envelope-From: doron.behar@gmail.com X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | 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=W8DlAufp7EdNpjDe/bj/h1feGRGKcmw7U/D8tb7hsX8=; b=hO9XE2CEIu9Jc0P/x8j1THJbfR/3ZtIL6I6GqoOF1CR/Heyw6N+MSqgxWPfSLVzK5t W3HKTr4Kg3abEIoWzcfHrhexKzQMnZYleR+zWw8pZVasnc1kBiOPJxTP7+8i64QO3vE1 BIbQsdJZMQAY9yhzhWkdW9vAJE1ZEIryWzFiycNuf3+/8R61IV18IQbtVffKhL+b01rt EmKuC0bIkHwl9KKm7QRsuqRW6Fp1WCVriUjbeSjLmWZTdU1tmfjY+RBU/Ds+aPhhkFx3 l6z3XQbKXJRp2CJAwRs5/Yt0lWNEkxjfaBlh2cZWw/5hui4NqHKajnooQI2y2DI8AySp QJQA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=W8DlAufp7EdNpjDe/bj/h1feGRGKcmw7U/D8tb7hsX8=; b=eNyL5wdWbB7XzKU3ppFGSHGevrjQdEl+9yTfcSaNYD7vnYzrL5cksdx+T4pLUJmSCU pTcfTgH1DPr4CeUwFhppHtHW4b0MbmbJ0WQsciel2RYj+6L16qDGB7zKZ5m7P2szU0Jv umoN6/0NqlU5QOWkID6tKOxTCRS/a56K12a7X4bkan5fYJOVW8YMb3k9V9GPFgAb5y/y VaG/sdaXTir29C4V+Yr86V71+FboquK1RIjFs01bbDzLHcf6nUmhCvTadopsHqpCziGC bFVbWaniQUvZdD7wusowMmzmD3HA8mbekEl0CzkZTG5YetHvQMUhX06QitDncdFerg+b 2HRg== X-Gm-Message-State: ALKqPwcmcSrOdG+60kwJqBJujgEoqdnPqi4qsi+RnUUdT7V4uYw/I6Lc r+0YHuhLhuR/6UDkDO2zGigkPVWN X-Google-Smtp-Source: ADUXVKIoa+7dVyFqLDc72m1P9r9/ewh+rup0XSz9o43qdK951ytWfMGjDr/cMGLZPcxOdVwoDKijDw== X-Received: by 2002:adf:dd8c:: with SMTP id x12-v6mr1985054wrl.212.1527347231481; Sat, 26 May 2018 08:07:11 -0700 (PDT) From: doron.behar@gmail.com To: zsh-workers@zsh.org Subject: [PATCH 04/25] Remove variables and use their contents directly. Date: Sat, 26 May 2018 18:06:13 +0300 Message-Id: <20180526150634.15683-5-doron.behar@gmail.com> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180526150634.15683-1-doron.behar@gmail.com> References: <20180526150634.15683-1-doron.behar@gmail.com> From: Doron Behar --- Completion/Unix/Command/_luarocks | 108 +++++++++++++++++++----------- 1 file changed, 69 insertions(+), 39 deletions(-) diff --git a/Completion/Unix/Command/_luarocks b/Completion/Unix/Command/_luarocks index bb5588251..b14f6a8b3 100644 --- a/Completion/Unix/Command/_luarocks +++ b/Completion/Unix/Command/_luarocks @@ -1,39 +1,5 @@ #compdef luarocks -# {{{ General options -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)"}' -) -# }}} -# {{{ All commands -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]' @@ -55,6 +21,8 @@ _luarocks_build_deps_mode(){ ) _describe 'dependencies mode' modes } +_luarocks_build(){ +} # }}} # {{{ `config` command sets a flag in the format VAR=VALUE local config_command_options=( @@ -65,12 +33,16 @@ 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]' ) +_luarocks_config(){ +} # }}} # {{{ `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]' ) +_luarocks_doc(){ +} # }}} # {{{ `download` command receives an argument of an external only rockspec local download_command_options=( @@ -79,28 +51,44 @@ local download_command_options=( '--rockspec[Download .rockspec if available]' '--arch=[Download rock for a specific architecture]:ARCH:' ) +_luarocks_download(){ +} # }}} # {{{ `help` command receives an argument of an internal command +_luarocks_help(){ +} # }}} # {{{ `install` command receives the same argument as the build command and it accepts the same options as well +_luarocks_install(){ +} # }}} # {{{ `lint` command receives an argument of a rockspec file +_luarocks_lint(){ +} # }}} # {{{ `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]' ) +_luarocks_list(){ +} # }}} # {{{ `make` command receives an argument of a rockspec file # it's options were already described above. +_luarocks_make(){ +} # }}} # {{{ `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' ) +_luarocks_new_version(){ +} # }}} # {{{ `pack` command receives as an argument a .rockspec file, or external rock and afterwards a version +_luarocks_pack(){ +} # }}} # {{{ `path` command receives only options local path_command_options=( @@ -110,6 +98,8 @@ 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)]' ) +_luarocks_path(){ +} # }}} # {{{ `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]' @@ -117,6 +107,8 @@ local purge_command_options=( '--old-versions[Keep the highest-numbered version of each rock and remove the other ones]' $option_force ) +_luarocks_purge(){ +} # }}} # {{{ `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]' @@ -125,6 +117,8 @@ local remove_command_options=( $option_force $option_force_fast ) +_luarocks_remove(){ +} # }}} # {{{ `search` command receives as an argument only a string as a search query local search_command_options=( @@ -132,6 +126,8 @@ 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]' ) +_luarocks_search(){ +} # }}} # {{{ `show` command receives as an argument only an installed rock local show_command_options=( @@ -143,11 +139,15 @@ local show_command_options=( '--rock-tree[local tree where rock is installed]' '--rock-dir[data directory of the installed rock]' ) +_luarocks_show(){ +} # }}} # {{{ `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]' ) +_luarocks_unpack(){ +} # }}} # {{{ `upload` command receives as an argument a rockspec file with .src.rock extension local upload_command_options=( @@ -155,6 +155,8 @@ 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]' ) +_luarocks_upload(){ +} # }}} # {{{ `write_rockspec` command receives as an argument a name and a version with optionally a URL/PATH local write_rockspec_command_options=( @@ -176,11 +178,39 @@ _luarocks_version(){ } # }}} -# {{{ Helpers -_luarocks_commands(){ +# The real thing +_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_rockspect:'Write a template for a rockspec file' + ) _describe 'command' commands } -# }}} -# The real thing -_arguments "${general_options[@]}" '*:COMMAND:_luarocks_commands' +_arguments \ + '(--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)"}' \ + '*:COMMAND:_luarocks_command' + -- 2.17.0