From a4492f0f25b01cb89df5f5f78e3c3abe32644676 Mon Sep 17 00:00:00 2001 From: Laurent Goussard Date: Thu, 6 Feb 2014 15:20:18 +0100 Subject: [PATCH 1/7] [Add] Enable composer completions --- src/_composer | 248 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 248 insertions(+) create mode 100644 src/_composer diff --git a/src/_composer b/src/_composer new file mode 100644 index 0000000..0ba9250 --- /dev/null +++ b/src/_composer @@ -0,0 +1,248 @@ +#compdef composer +# ------------------------------------------------------------------------------ +# Description +# ----------- +# +# Completion script for composer (https://getcomposer.org/). +# +# ------------------------------------------------------------------------------ +# Authors +# ------- +# +# * loranger (https://github.com/loranger) +# +# ------------------------------------------------------------------------------ + +_composer_global_options() { + _values : \ + "--xml[To output help as XML]" \ + "--format[To output help in other formats]:format:" \ + "--raw[To output raw command help]" \ + "(help,h)"{--help,-h}"[Display this help message.]" \ + "(quite,q)"{--quiet,-q}"[Do not output any message.]" \ + "--verbose[Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug]:Verbosity:(1 2 3)" \ + "(v,vv,vvv)"{-v,-vv,-vvv}"[Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug]" \ + "(version,V)"{--version,-V}"[Display this application version.]" \ + "--ansi[Force ANSI output.]" \ + "--no-ansi[Disable ANSI output.]" \ + "(no-interaction,n)"{--no-interaction,-n}"[Do not ask any interactive question.]" \ + "--profile[Display timing and memory usage information]" \ + "(working-dir)"{--working-dir,-d}"[If specified, use the given directory as working directory.]:files:_files -/" +} + +_composer_cmd() { + _values : \ + "about[Short information about Composer]" \ + "archive[Create an archive of this composer package]" \ + "config[Set config options]" \ + "create-project[Create new project from a package into given directory.]" \ + "depends[Shows which packages depend on the given package]" \ + "diagnose[Diagnoses the system to identify common errors.]" \ + "dump-autoload[Dumps the autoloader]" \ + "dumpautoload[Dumps the autoloader]" \ + "help[Displays help for a command]" \ + "init[Creates a basic composer.json file in current directory.]" \ + "install[Installs the project dependencies from the composer.lock file if present, or falls back on the composer.json.]" \ + "list[Lists commands]" \ + "require[Adds required packages to your composer.json and installs them]" \ + "run-script[Run the scripts defined in composer.json.]" \ + "search[Search for packages]" \ + "self-update[Updates composer.phar to the latest version.]" \ + "selfupdate[Updates composer.phar to the latest version.]" \ + "show[Show information about packages]" \ + "status[Show a list of locally modified packages]" \ + "update[Updates your dependencies to the latest version according to composer.json, and updates the composer.lock file.]" \ + "validate[Validates a composer.json]" \ + "*:options:_composer_global_options" +} + +_composer_cmd_archive() { + _arguments : \ + "(format,f)"{--format,-f}"[Format of the resulting archive: tar or zip (default: 'tar')]:format:(tar zip)" \ + "--dir[Write the archive to this directory (default: '.')]:working dir:_files -/" \ + ":Package:" \ + ":Version:" +} + +_composer_cmd_config() { + _arguments : \ + "(global,g)"{--global,-g}"[Apply command to the global config file]" \ + "(editor,e)"{--editor,-e}"[Open editor]" \ + "--unset[Unset the given setting-key]" \ + "(list,l)"{--list,-l}"[List configuration settings]" \ + "(file,f)"{--file,-f}"[If you want to choose a different composer.json or config.json (default: 'composer.json')]:config:_files" \ + ":Setting key:" \ + ":Setting value:" +} + +_composer_cmd_create-project() { + _arguments : \ + "(stability,s)"{--stability,-s}"[Minimum-stability allowed (unless a version is specified). (default: 'stable')]:Stability:" \ + "--prefer-source[Forces installation from package sources when possible, including VCS information.]" \ + "--prefer-dist[Forces installation from package dist even for dev versions.]" \ + "--repository-url[Pick a different repository url to look for the package.]" \ + "--dev[Whether to install dependencies for development.]" \ + "--no-custom-installers[Whether to disable custom installers.]" \ + "--no-scripts[Whether to prevent execution of all defined scripts in the root package.]" \ + "--no-progress[Do not output download progress.]" \ + "--keep-vcs[Whether to prevent deletion vcs folder.]" \ + ":Package:" \ + ":Destination directory:_files -/" \ + ":Version:" +} + +_composer_cmd_depends() { + _arguments : \ + "--link-type[Link types to show (require, require-dev) (default: \['require','require-dev'\]) (multiple values allowed)]:Link types:(require require-dev)" \ + ":Package:" +} + +_composer_cmd_dumpautoload() { + _arguments : \ + "(optimize,o)"{--optimize,-o}"[Optimizes PSR0 packages to be loaded with classmaps too, good for production.]" +} + +_composer_cmd_dump-autoload() { + _arguments : \ + "*:args:_composer_cmd_dumpautoload" +} + +_composer_cmd_help() { + _arguments : \ + "(- 1 *):command:_composer_cmd" +} + +_composer_cmd_init() { + _arguments : \ + "--name[Name of the package]" \ + "--description[Description of package]" \ + "--author[Author name of package]" \ + "--homepage[Homepage of package]" \ + "--require[Package to require with a version constraint (e.g. foo/bar:1.0.0 or foo/bar=1.0.0 or \\\"foo/bar 1.0.0\\\")]" \ + "--require-dev[Package to require for development with a version constraint (e.g. foo/bar:1.0.0 or foo/bar=1.0.0 or \\\"foo/bar 1.0.0\\\")]" \ + "(stability,s)"{--stability,-s}"[Minimum stability]:Stability:(stable RC beta alpha dev)" \ + "(license,l)"{--license,-l}"[License of package]" +} + +_composer_cmd_install() { + _arguments : \ + "--prefer-source[Forces installation from package sources when possible, including VCS information.]" \ + "--prefer-dist[Forces installation from package dist even for dev versions.]" \ + "--dry-run[Outputs the operations but will not execute anything (implicitly enables --verbose).]" \ + "--dev[Enables installation of require-dev packages.]" \ + "--no-dev[Disables installation of require-dev packages (enabled by default, only present for sanity).]" \ + "--no-custom-installers[Disables all custom installers.]" \ + "--no-scripts[Skips the execution of all scripts defined in composer.json file.]" \ + "--no-progress[Do not output download progress.]" \ + "--verbose[Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug]:Verbosity:(1 2 3)" \ + "(v,vv,vvv)"{-v,-vv,-vvv}"[Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug]" \ + "(optimize-autoloader,o)"{--optimize-autoloader,-o}"[Optimize autoloader during autoloader dump]" +} + +_composer_cmd_list() { + _arguments : \ + "--xml[To output help as XML]" \ + "--format[To output help in other formats]:format:" \ + "--raw[To output raw command help]" \ + ":Namespace:" +} + +_composer_cmd_require() { + _arguments : \ + "--dev[Add requirement to require-dev.]" \ + "--prefer-source[Forces installation from package sources when possible, including VCS information.]" \ + "--prefer-dist[Forces installation from package dist even for dev versions.]" \ + "--no-progress[Do not output download progress.]" \ + "--no-update[Disables the automatic update of the dependencies.]" \ + ":Packages (e.g. foo/bar\:1.0.0 or foo/bar=1.0.0 or \"foo/bar 1.0.0\"):" \ +} + +_composer_cmd_run-script() { + _arguments : \ + "--dev[Sets the dev mode.]" \ + "--no-dev[Disables the dev mode.]" \ + ":Script name:" +} + +_composer_cmd_search() { + _arguments : \ + "(only-name,N)"{--only-name,-N}"[Search only in name]" \ + ":Tokens to search for:" +} + +_composer_cmd_show() { + _arguments : \ + "(installed,i)"{--installed,-i}"[List installed packages only]" \ + "(platform,p)"{--platform,-p}"[List platform packages only]" \ + "(available,a)"{--available,-a}"[List available packages only]" \ + "(self,s)"{--self,-s}"[Show the root package information]" \ + "(name-only,N)"{--name-only,-N}"[List package names only]" \ + ":Package:" \ + ":Version:" +} + +_composer_cmd_status() { + _arguments : \ + "--verbose[Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug]:Verbosity:(1 2 3)" \ + "(v,vv,vvv)"{-v,-vv,-vvv}"[Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug]" +} + +_composer_cmd_update() { + _arguments : \ + "--prefer-source[Forces installation from package sources when possible, including VCS information.]" \ + "--prefer-dist[Forces installation from package dist even for dev versions.]" \ + "--dry-run[Outputs the operations but will not execute anything (implicitly enables --verbose).]" \ + "--dev[Enables installation of require-dev packages (enabled by default, only present for sanity).]" \ + "--no-dev[Disables installation of require-dev packages.]" \ + "--no-custom-installers[Disables all custom installers.]" \ + "--no-scripts[Skips the execution of all scripts defined in composer.json file.]" \ + "--no-progress[Do not output download progress.]" \ + "--verbose[Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug]:Verbosity:(1 2 3)" \ + "(v,vv,vvv)"{-v,-vv,-vvv}"[Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug]" \ + "(optimize-autoloader,o)"{--optimize-autoloader,-o}"[Optimize autoloader during autoloader dump]" \ + ":Packages:" +} + +_composer_cmd_validate() { + _arguments : \ + ":Json file:_files" +} + +_composer() { + if (( CURRENT > 2)); then + cmd=${words[2]} + # Set the context for the subcommand. + curcontext="${curcontext%:*:*}:composer-$cmd" + # Narrow the range of words we are looking at to exclude 'composer' + (( CURRENT-- )) + shift words + # Run the completion for the subcommand + (( $+functions[_composer_cmd_$cmd] )) && _composer_cmd_$cmd + else + _arguments : \ + "--xml[To output help as XML]" \ + "--format[To output help in other formats]:format:" \ + "--raw[To output raw command help]" \ + "(help,h)"{--help,-h}"[Display this help message.]" \ + "(quite,q)"{--quiet,-q}"[Do not output any message.]" \ + "--verbose[Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug]:Verbosity:(1 2 3)" \ + "(v,vv,vvv)"{-v,-vv,-vvv}"[Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug]" \ + "(version,V)"{--version,-V}"[Display this application version.]" \ + "--ansi[Force ANSI output.]" \ + "--no-ansi[Disable ANSI output.]" \ + "(no-interaction,n)"{--no-interaction,-n}"[Do not ask any interactive question.]" \ + "--profile[Display timing and memory usage information]" \ + "(working-dir)"{--working-dir,-d}"[If specified, use the given directory as working directory.]:files:_files -/" \ + ":command:_composer_cmd" + fi +} + +_composer "$@" + +# Local Variables: +# mode: Shell-Script +# sh-indentation: 2 +# indent-tabs-mode: nil +# sh-basic-offset: 2 +# End: +# vim: ft=zsh sw=2 ts=2 et \ No newline at end of file From 74cd5edbf43ee601ee81c691eb82365279c9d164 Mon Sep 17 00:00:00 2001 From: Laurent Goussard Date: Thu, 6 Feb 2014 15:22:51 +0100 Subject: [PATCH 2/7] [Add] Glances completion --- src/_glances | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 src/_glances diff --git a/src/_glances b/src/_glances new file mode 100644 index 0000000..3f4beb2 --- /dev/null +++ b/src/_glances @@ -0,0 +1,46 @@ +#compdef glances +# ------------------------------------------------------------------------------ +# Description +# ----------- +# +# Completion script for glances (http://nicolargo.github.com/glances/). +# +# ------------------------------------------------------------------------------ +# Authors +# ------- +# +# * loranger (https://github.com/loranger) +# +# ------------------------------------------------------------------------------ + +_glances() { + + _arguments \ + "-b[Display network rate in Byte per second]" \ + "-B[Bind server to the given IP or host NAME]:host:_hosts" \ + "-c[Connect to a Glances server]:host:_hosts" \ + "-C[Path to the configuration file]:configuration path:_files -/" \ + "-d[Disable disk I/O module]" \ + "-e[Enable the sensors module (Linux-only)]" \ + "-f[Set the output folder (HTML) or file (CSV)]:output path:_files -/" \ + "-h[Display the syntax and exit]" \ + "-m[Disable mount module]" \ + "-n[Disable network module]" \ + "-o[Define additional output (available: HTML or CSV)]:output type:(HTML CSV)" \ + "-p[Define the client or server TCP port (default: 61209)]:port:_ports" \ + "-P[Client/server password]:password:" \ + "-s[Run Glances in server mode]" \ + "-t[Set the refresh time in seconds (default: 3)]:seconds:" \ + "-v[Display the version and exit]" \ + "-z[Do not use the bold color attribute]" \ +} + +_glances "$@" + +# Local Variables: +# mode: Shell-Script +# sh-indentation: 2 +# indent-tabs-mode: nil +# sh-basic-offset: 2 +# End: +# vim: ft=zsh sw=2 ts=2 et \ No newline at end of file From 818fe9c8e1d3417de716d7c7b03fd700acf6c392 Mon Sep 17 00:00:00 2001 From: Laurent Goussard Date: Sun, 13 Apr 2014 10:46:39 +0200 Subject: [PATCH 3/7] [Upg] Add copyright header and contextual command definition --- src/_composer | 282 ++++++++++---------------------------------------- 1 file changed, 55 insertions(+), 227 deletions(-) diff --git a/src/_composer b/src/_composer index 0ba9250..0b03204 100644 --- a/src/_composer +++ b/src/_composer @@ -1,5 +1,30 @@ #compdef composer # ------------------------------------------------------------------------------ +# Copyright (c) 2011 Github zsh-users - http://github.com/zsh-users +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are met: +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# * Neither the name of the zsh-users nor the +# names of its contributors may be used to endorse or promote products +# derived from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +# DISCLAIMED. IN NO EVENT SHALL ZSH-USERS BE LIABLE FOR ANY +# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# ------------------------------------------------------------------------------ # Description # ----------- # @@ -9,240 +34,43 @@ # Authors # ------- # +# * Daniel Gomes (me@danielcsgomes.com) +# * Valerii Hiora (https://github.com/vhbit) # * loranger (https://github.com/loranger) # # ------------------------------------------------------------------------------ -_composer_global_options() { - _values : \ - "--xml[To output help as XML]" \ - "--format[To output help in other formats]:format:" \ - "--raw[To output raw command help]" \ - "(help,h)"{--help,-h}"[Display this help message.]" \ - "(quite,q)"{--quiet,-q}"[Do not output any message.]" \ - "--verbose[Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug]:Verbosity:(1 2 3)" \ - "(v,vv,vvv)"{-v,-vv,-vvv}"[Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug]" \ - "(version,V)"{--version,-V}"[Display this application version.]" \ - "--ansi[Force ANSI output.]" \ - "--no-ansi[Disable ANSI output.]" \ - "(no-interaction,n)"{--no-interaction,-n}"[Do not ask any interactive question.]" \ - "--profile[Display timing and memory usage information]" \ - "(working-dir)"{--working-dir,-d}"[If specified, use the given directory as working directory.]:files:_files -/" +local curcontext=$curcontext state line +declare -A opt_args + +_composer_get_command_list () { + composer --no-ansi | sed "1,/Available commands/d" | awk '/^ [a-z]+/ { print $1 }' } -_composer_cmd() { - _values : \ - "about[Short information about Composer]" \ - "archive[Create an archive of this composer package]" \ - "config[Set config options]" \ - "create-project[Create new project from a package into given directory.]" \ - "depends[Shows which packages depend on the given package]" \ - "diagnose[Diagnoses the system to identify common errors.]" \ - "dump-autoload[Dumps the autoloader]" \ - "dumpautoload[Dumps the autoloader]" \ - "help[Displays help for a command]" \ - "init[Creates a basic composer.json file in current directory.]" \ - "install[Installs the project dependencies from the composer.lock file if present, or falls back on the composer.json.]" \ - "list[Lists commands]" \ - "require[Adds required packages to your composer.json and installs them]" \ - "run-script[Run the scripts defined in composer.json.]" \ - "search[Search for packages]" \ - "self-update[Updates composer.phar to the latest version.]" \ - "selfupdate[Updates composer.phar to the latest version.]" \ - "show[Show information about packages]" \ - "status[Show a list of locally modified packages]" \ - "update[Updates your dependencies to the latest version according to composer.json, and updates the composer.lock file.]" \ - "validate[Validates a composer.json]" \ - "*:options:_composer_global_options" +_composer_get_required_list () { + composer show -s --no-ansi | sed '1,/requires/d' | awk 'NF > 0 && !/^requires \(dev\)/{ print $1 }' } -_composer_cmd_archive() { - _arguments : \ - "(format,f)"{--format,-f}"[Format of the resulting archive: tar or zip (default: 'tar')]:format:(tar zip)" \ - "--dir[Write the archive to this directory (default: '.')]:working dir:_files -/" \ - ":Package:" \ - ":Version:" + +_composer () { + local curcontext="$curcontext" state line + typeset -A opt_args + + _arguments \ + '1: :->command'\ + '*: :->args' + if [ -f composer.json ]; then + case $state in + command) + compadd `_composer_get_command_list` + ;; + *) + compadd `_composer_get_required_list` + ;; + esac + else + compadd create-project init search selfupdate show + fi } -_composer_cmd_config() { - _arguments : \ - "(global,g)"{--global,-g}"[Apply command to the global config file]" \ - "(editor,e)"{--editor,-e}"[Open editor]" \ - "--unset[Unset the given setting-key]" \ - "(list,l)"{--list,-l}"[List configuration settings]" \ - "(file,f)"{--file,-f}"[If you want to choose a different composer.json or config.json (default: 'composer.json')]:config:_files" \ - ":Setting key:" \ - ":Setting value:" -} - -_composer_cmd_create-project() { - _arguments : \ - "(stability,s)"{--stability,-s}"[Minimum-stability allowed (unless a version is specified). (default: 'stable')]:Stability:" \ - "--prefer-source[Forces installation from package sources when possible, including VCS information.]" \ - "--prefer-dist[Forces installation from package dist even for dev versions.]" \ - "--repository-url[Pick a different repository url to look for the package.]" \ - "--dev[Whether to install dependencies for development.]" \ - "--no-custom-installers[Whether to disable custom installers.]" \ - "--no-scripts[Whether to prevent execution of all defined scripts in the root package.]" \ - "--no-progress[Do not output download progress.]" \ - "--keep-vcs[Whether to prevent deletion vcs folder.]" \ - ":Package:" \ - ":Destination directory:_files -/" \ - ":Version:" -} - -_composer_cmd_depends() { - _arguments : \ - "--link-type[Link types to show (require, require-dev) (default: \['require','require-dev'\]) (multiple values allowed)]:Link types:(require require-dev)" \ - ":Package:" -} - -_composer_cmd_dumpautoload() { - _arguments : \ - "(optimize,o)"{--optimize,-o}"[Optimizes PSR0 packages to be loaded with classmaps too, good for production.]" -} - -_composer_cmd_dump-autoload() { - _arguments : \ - "*:args:_composer_cmd_dumpautoload" -} - -_composer_cmd_help() { - _arguments : \ - "(- 1 *):command:_composer_cmd" -} - -_composer_cmd_init() { - _arguments : \ - "--name[Name of the package]" \ - "--description[Description of package]" \ - "--author[Author name of package]" \ - "--homepage[Homepage of package]" \ - "--require[Package to require with a version constraint (e.g. foo/bar:1.0.0 or foo/bar=1.0.0 or \\\"foo/bar 1.0.0\\\")]" \ - "--require-dev[Package to require for development with a version constraint (e.g. foo/bar:1.0.0 or foo/bar=1.0.0 or \\\"foo/bar 1.0.0\\\")]" \ - "(stability,s)"{--stability,-s}"[Minimum stability]:Stability:(stable RC beta alpha dev)" \ - "(license,l)"{--license,-l}"[License of package]" -} - -_composer_cmd_install() { - _arguments : \ - "--prefer-source[Forces installation from package sources when possible, including VCS information.]" \ - "--prefer-dist[Forces installation from package dist even for dev versions.]" \ - "--dry-run[Outputs the operations but will not execute anything (implicitly enables --verbose).]" \ - "--dev[Enables installation of require-dev packages.]" \ - "--no-dev[Disables installation of require-dev packages (enabled by default, only present for sanity).]" \ - "--no-custom-installers[Disables all custom installers.]" \ - "--no-scripts[Skips the execution of all scripts defined in composer.json file.]" \ - "--no-progress[Do not output download progress.]" \ - "--verbose[Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug]:Verbosity:(1 2 3)" \ - "(v,vv,vvv)"{-v,-vv,-vvv}"[Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug]" \ - "(optimize-autoloader,o)"{--optimize-autoloader,-o}"[Optimize autoloader during autoloader dump]" -} - -_composer_cmd_list() { - _arguments : \ - "--xml[To output help as XML]" \ - "--format[To output help in other formats]:format:" \ - "--raw[To output raw command help]" \ - ":Namespace:" -} - -_composer_cmd_require() { - _arguments : \ - "--dev[Add requirement to require-dev.]" \ - "--prefer-source[Forces installation from package sources when possible, including VCS information.]" \ - "--prefer-dist[Forces installation from package dist even for dev versions.]" \ - "--no-progress[Do not output download progress.]" \ - "--no-update[Disables the automatic update of the dependencies.]" \ - ":Packages (e.g. foo/bar\:1.0.0 or foo/bar=1.0.0 or \"foo/bar 1.0.0\"):" \ -} - -_composer_cmd_run-script() { - _arguments : \ - "--dev[Sets the dev mode.]" \ - "--no-dev[Disables the dev mode.]" \ - ":Script name:" -} - -_composer_cmd_search() { - _arguments : \ - "(only-name,N)"{--only-name,-N}"[Search only in name]" \ - ":Tokens to search for:" -} - -_composer_cmd_show() { - _arguments : \ - "(installed,i)"{--installed,-i}"[List installed packages only]" \ - "(platform,p)"{--platform,-p}"[List platform packages only]" \ - "(available,a)"{--available,-a}"[List available packages only]" \ - "(self,s)"{--self,-s}"[Show the root package information]" \ - "(name-only,N)"{--name-only,-N}"[List package names only]" \ - ":Package:" \ - ":Version:" -} - -_composer_cmd_status() { - _arguments : \ - "--verbose[Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug]:Verbosity:(1 2 3)" \ - "(v,vv,vvv)"{-v,-vv,-vvv}"[Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug]" -} - -_composer_cmd_update() { - _arguments : \ - "--prefer-source[Forces installation from package sources when possible, including VCS information.]" \ - "--prefer-dist[Forces installation from package dist even for dev versions.]" \ - "--dry-run[Outputs the operations but will not execute anything (implicitly enables --verbose).]" \ - "--dev[Enables installation of require-dev packages (enabled by default, only present for sanity).]" \ - "--no-dev[Disables installation of require-dev packages.]" \ - "--no-custom-installers[Disables all custom installers.]" \ - "--no-scripts[Skips the execution of all scripts defined in composer.json file.]" \ - "--no-progress[Do not output download progress.]" \ - "--verbose[Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug]:Verbosity:(1 2 3)" \ - "(v,vv,vvv)"{-v,-vv,-vvv}"[Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug]" \ - "(optimize-autoloader,o)"{--optimize-autoloader,-o}"[Optimize autoloader during autoloader dump]" \ - ":Packages:" -} - -_composer_cmd_validate() { - _arguments : \ - ":Json file:_files" -} - -_composer() { - if (( CURRENT > 2)); then - cmd=${words[2]} - # Set the context for the subcommand. - curcontext="${curcontext%:*:*}:composer-$cmd" - # Narrow the range of words we are looking at to exclude 'composer' - (( CURRENT-- )) - shift words - # Run the completion for the subcommand - (( $+functions[_composer_cmd_$cmd] )) && _composer_cmd_$cmd - else - _arguments : \ - "--xml[To output help as XML]" \ - "--format[To output help in other formats]:format:" \ - "--raw[To output raw command help]" \ - "(help,h)"{--help,-h}"[Display this help message.]" \ - "(quite,q)"{--quiet,-q}"[Do not output any message.]" \ - "--verbose[Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug]:Verbosity:(1 2 3)" \ - "(v,vv,vvv)"{-v,-vv,-vvv}"[Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug]" \ - "(version,V)"{--version,-V}"[Display this application version.]" \ - "--ansi[Force ANSI output.]" \ - "--no-ansi[Disable ANSI output.]" \ - "(no-interaction,n)"{--no-interaction,-n}"[Do not ask any interactive question.]" \ - "--profile[Display timing and memory usage information]" \ - "(working-dir)"{--working-dir,-d}"[If specified, use the given directory as working directory.]:files:_files -/" \ - ":command:_composer_cmd" - fi -} - -_composer "$@" - -# Local Variables: -# mode: Shell-Script -# sh-indentation: 2 -# indent-tabs-mode: nil -# sh-basic-offset: 2 -# End: -# vim: ft=zsh sw=2 ts=2 et \ No newline at end of file +compdef _composer composer \ No newline at end of file From 1c18daf1d5af3e7638928f79443979a5b0bcbec6 Mon Sep 17 00:00:00 2001 From: Laurent Goussard Date: Sun, 13 Apr 2014 10:51:23 +0200 Subject: [PATCH 4/7] [Upg] Add copyright header and cleanp --- src/_glances | 35 ++++++++++++++++++++++++++--------- 1 file changed, 26 insertions(+), 9 deletions(-) diff --git a/src/_glances b/src/_glances index 3f4beb2..e0298ea 100644 --- a/src/_glances +++ b/src/_glances @@ -1,5 +1,30 @@ #compdef glances # ------------------------------------------------------------------------------ +# Copyright (c) 2011 Github zsh-users - http://github.com/zsh-users +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are met: +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# * Neither the name of the zsh-users nor the +# names of its contributors may be used to endorse or promote products +# derived from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +# DISCLAIMED. IN NO EVENT SHALL ZSH-USERS BE LIABLE FOR ANY +# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# ------------------------------------------------------------------------------ # Description # ----------- # @@ -35,12 +60,4 @@ _glances() { "-z[Do not use the bold color attribute]" \ } -_glances "$@" - -# Local Variables: -# mode: Shell-Script -# sh-indentation: 2 -# indent-tabs-mode: nil -# sh-basic-offset: 2 -# End: -# vim: ft=zsh sw=2 ts=2 et \ No newline at end of file +_glances "$@" \ No newline at end of file From 7f813c193e23e084945f12f7b392b2c15690aee1 Mon Sep 17 00:00:00 2001 From: Laurent Goussard Date: Sun, 13 Apr 2014 10:53:00 +0200 Subject: [PATCH 5/7] [Add] Artisan completion --- src/_artisan | 53 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 src/_artisan diff --git a/src/_artisan b/src/_artisan new file mode 100644 index 0000000..23c8e64 --- /dev/null +++ b/src/_artisan @@ -0,0 +1,53 @@ +#compdef artisan +# ------------------------------------------------------------------------------ +# Copyright (c) 2011 Github zsh-users - http://github.com/zsh-users +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are met: +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# * Neither the name of the zsh-users nor the +# names of its contributors may be used to endorse or promote products +# derived from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +# DISCLAIMED. IN NO EVENT SHALL ZSH-USERS BE LIABLE FOR ANY +# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# ------------------------------------------------------------------------------ +# Description +# ----------- +# +# Completion script for artisan (http://laravel.com/docs/artisan). +# +# ------------------------------------------------------------------------------ +# Authors +# ------- +# +# * loranger (https://github.com/loranger) +# +# ------------------------------------------------------------------------------ + + +_artisan_get_command_list () { + php artisan | sed "1,/Available commands/d" | awk '/^ [a-z]+/ { print $1 }' +} + +_artisan () { + if [ -f artisan ]; then + compadd `_artisan_get_command_list` + fi +} + +compdef _artisan php artisan +compdef _artisan artisan From 6ef029c3cc51e511bc067a01b96873ae86a60cb0 Mon Sep 17 00:00:00 2001 From: Laurent Goussard Date: Sun, 13 Apr 2014 10:53:21 +0200 Subject: [PATCH 6/7] [Add] symfony/Console completion --- src/_console | 53 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 src/_console diff --git a/src/_console b/src/_console new file mode 100644 index 0000000..91e8b16 --- /dev/null +++ b/src/_console @@ -0,0 +1,53 @@ +#compdef console +# ------------------------------------------------------------------------------ +# Copyright (c) 2011 Github zsh-users - http://github.com/zsh-users +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are met: +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# * Neither the name of the zsh-users nor the +# names of its contributors may be used to endorse or promote products +# derived from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +# DISCLAIMED. IN NO EVENT SHALL ZSH-USERS BE LIABLE FOR ANY +# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# ------------------------------------------------------------------------------ +# Description +# ----------- +# +# Completion script for symfony console (https://github.com/symfony/Console). +# +# ------------------------------------------------------------------------------ +# Authors +# ------- +# +# * loranger (https://github.com/loranger) +# +# ------------------------------------------------------------------------------ + + +_console_get_command_list () { + php console | sed "1,/Available commands/d" | awk '/^ [a-z]+/ { print $1 }' +} + +_console () { + if [ -f console ]; then + compadd `_console_get_command_list` + fi +} + +compdef _console php console +compdef _console console From f12c638bd739b43ffca803360774bbeb297bbec0 Mon Sep 17 00:00:00 2001 From: Laurent Goussard Date: Sun, 13 Apr 2014 10:53:49 +0200 Subject: [PATCH 7/7] [Add] Envoy completion --- src/_envoy | 67 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 src/_envoy diff --git a/src/_envoy b/src/_envoy new file mode 100644 index 0000000..e9ece6c --- /dev/null +++ b/src/_envoy @@ -0,0 +1,67 @@ +#compdef envoy +# ------------------------------------------------------------------------------ +# Copyright (c) 2011 Github zsh-users - http://github.com/zsh-users +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are met: +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# * Neither the name of the zsh-users nor the +# names of its contributors may be used to endorse or promote products +# derived from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +# DISCLAIMED. IN NO EVENT SHALL ZSH-USERS BE LIABLE FOR ANY +# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# ------------------------------------------------------------------------------ +# Description +# ----------- +# +# Completion script for envoy (https://github.com/laravel/envoy). +# +# ------------------------------------------------------------------------------ +# Authors +# ------- +# +# * loranger (https://github.com/loranger) +# +# ------------------------------------------------------------------------------ + + +_envoy_get_command_list () { + envoy --no-ansi | sed "1,/Available commands/d" | awk '/^ [a-z]+/ { print $1 }' +} + +_envoy_get_option_list () { + envoy --no-ansi | sed "1,/Options/d" | awk '/^ --[a-z]+/ { print $1 }' +} + +_envoy_get_help_list () { + envoy help $1 --no-ansi | sed "1,/Options/d" | awk '/^ --[a-z]+/ { print $1 }' +} + +_envoy_get_task_list () { + if [ $1 = 'run' ] && [ -f Envoy.blade.php ]; then + perl -nE "say $& if /(task|macro)\('\K[^']+/g" Envoy.blade.php + fi +} + +_envoy () { + _arguments : \ + `_envoy_get_option_list` \ + ":command:compadd `_envoy_get_command_list`" \ + ":task:compadd `_envoy_get_task_list $words[$CURRENT-1]`" +} + +compdef _envoy envoy