Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
[PATCH 21/25] Use 2 spaces instead of tabs.
- X-seq: zsh-workers 42848
- From: doron.behar@xxxxxxxxx
- To: zsh-workers@xxxxxxx
- Subject: [PATCH 21/25] Use 2 spaces instead of tabs.
- Date: Sat, 26 May 2018 18:06:30 +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=1pDijS+/9xIA7urnPE+G9QyvpwkhJt0p8B/jaCmoNfs=; b=EZcN7aW5Jv4ekJalO1r6IIZgStWz2lT26ntqvJOj06Mf0YKWf5ZE9XkHAeq7jDkdV9 GmiyznIBQtMSNztkHfr/hrLBkJjznt90W5uX7EkxRZiLsLDF8pEZ5MiPQ2AV2ZfvPBKa BYBG/vi5H2zhNaG+xsp28K1LaIoekVJv3zt5TeIrOx9l6QB7mjNoVyc+JjI5cL+SYUSB 56nrbJC9ISnb+0wYJ60Il8iPYYk+CjTryi4+Pqne+ErmwibTv5grmgd3/M6qbNgVYe55 mPqz/c7A6bjPrEJeOmBXKPcLdWvoVoI8bghJ56xez/uCUDYZKHZht28/VAmbirXb9JOP OmUw==
- 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 | 542 +++++++++++++++---------------
src/_pip | 326 ------------------
2 files changed, 271 insertions(+), 597 deletions(-)
delete mode 100644 src/_pip
diff --git a/Completion/Unix/Command/_luarocks b/Completion/Unix/Command/_luarocks
index 24a62b085..1dda38cad 100644
--- a/Completion/Unix/Command/_luarocks
+++ b/Completion/Unix/Command/_luarocks
@@ -2,157 +2,157 @@
# {{{ helper: luarocks commands
__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 "$@"
+ 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'
__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
+ 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
__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
- _message -e "version for installed rock ${words[$i]}"
- 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
+ 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
+ _message -e "version for installed rock ${words[$i]}"
+ 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
__luarocks_lua_versions(){
- _values -s , 5.3 5.2 5.1
+ _values -s , 5.3 5.2 5.1
}
# }}}
# {{{ helper: 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
- local manifest_last_date_modified="$(date -r ~/.luarocks/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 ${manifest_last_date_modified} ]]; then
- # if the manifest file is newer then the cache:
- if [ ${manifest_last_date_modified} -ge ${cache_last_date_modified} ]; then
- (( 1 ))
- else
- (( 0 ))
- fi
- else
- (( 1 ))
- fi
+ # 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
+ local manifest_last_date_modified="$(date -r ~/.luarocks/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 ${manifest_last_date_modified} ]]; then
+ # if the manifest file is newer then the cache:
+ if [ ${manifest_last_date_modified} -ge ${cache_last_date_modified} ]; then
+ (( 1 ))
+ else
+ (( 0 ))
+ fi
+ else
+ (( 1 ))
+ fi
}
# }}}
# {{{ helper: installed rocks
__luarocks_installed_rocks(){
- 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 _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]} | 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
- _describe 'installed rocks' rocks_names_and_descriptions
+ 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 _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]} | 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
+ _describe 'installed rocks' rocks_names_and_descriptions
}
# }}}
# {{{ helper: rocks wrapper
@@ -161,35 +161,35 @@ __luarocks_installed_rocks(){
# - .src.rock file
# - external rock
__luarocks_rock(){
- local -a alts=()
- for arg in "$@"; do
- case $arg in
- (rockspec)
- alts+=(':rock file:{_files -g "*.rockspec"}')
- ;;
- (rockpack)
- alts+=(':rock file:{_files -g "*.src.rock"}')
- ;;
- (external)
- alts+=(':external rock:')
- ;;
- (installed)
- alts+=(':local rock:__luarocks_installed_rocks')
- ;;
- esac
- done
- _alternative ${alts[@]}
+ local -a alts=()
+ for arg in "$@"; do
+ case $arg in
+ (rockspec)
+ alts+=(':rock file:{_files -g "*.rockspec"}')
+ ;;
+ (rockpack)
+ alts+=(':rock file:{_files -g "*.src.rock"}')
+ ;;
+ (external)
+ alts+=(':external rock:')
+ ;;
+ (installed)
+ alts+=(':local rock:__luarocks_installed_rocks')
+ ;;
+ esac
+ done
+ _alternative ${alts[@]}
}
# }}}
# {{{ helper: 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
+ autoload +X _git
+ local _git_def="$(whence -v _git)"
+ . ${_git_def##* }
+ type __git_tags &> /dev/null
+ if [[ $? != 1 ]]; then
+ __git_tags
+ fi
}
# }}}
@@ -198,71 +198,71 @@ __luarocks_git_tags(){
# - 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"}'
+ '--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
+ "${make_command_options[@]}"
+ '--only-deps[Installs only the dependencies of the rock]'
+ $option_deps_mode
)
_luarocks_build(){
- _arguments -A "-*" \
- "${build_command_options[@]}" \
- '1: :{__luarocks_rock "rockspec" "external"}' \
- '2:: :{__luarocks_rock_version "external_or_local"}'
+ _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]'
+ '--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]'
)
_luarocks_config(){
- _arguments "${config_command_options[@]}"
+ _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]'
+ '--home[Open the home page of project]'
+ '--list[List documentation files only]'
)
_luarocks_doc(){
- _arguments \
- "${doc_command_options[@]}" \
- '1: :{__luarocks_rock "installed"}'
+ _arguments \
+ "${doc_command_options[@]}" \
+ '1: :{__luarocks_rock "installed"}'
}
# }}}
# {{{ `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:'
+ '--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_download(){
- _arguments -A "-*" \
- "${download_command_options[@]}" \
- '1: :{__luarocks_rock "external"}' \
- '2:: :{__luarocks_rock_version "external_or_local"}'
+ _arguments -A "-*" \
+ "${download_command_options[@]}" \
+ '1: :{__luarocks_rock "external"}' \
+ '2:: :{__luarocks_rock_version "external_or_local"}'
}
# }}}
# {{{ `help` command
# arguments:
# must: luarocks sub command
_luarocks_help(){
- _arguments '1: :__luarocks_command'
+ _arguments '1: :__luarocks_command'
}
# }}}
# {{{ `install` command
@@ -271,24 +271,24 @@ _luarocks_help(){
# - optional: version
# NOTE: it receives the same argument as the build command and it accepts the same options as well
_luarocks_install(){
- _luarocks_build
+ _luarocks_build
}
# }}}
# {{{ `lint` command
# arguments:
# - must: rockspec file (first and last)
_luarocks_lint(){
- _arguments '1::{__luarocks_rock "rockspec"}'
+ _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]'
+ '--outdated[List only rocks for which there is a higher version available in the rocks server]'
+ '--porcelain[Produce machine-friendly output]'
)
_luarocks_list(){
- _arguments "${list_command_options[@]}"
+ _arguments "${list_command_options[@]}"
}
# }}}
# {{{ `make` command
@@ -296,7 +296,7 @@ _luarocks_list(){
# - optional: rockspec file
# NOTE: it's options were already described above.
_luarocks_make(){
- _arguments '1:: :{__luarocks_rock "rockspec"}'
+ _arguments '1:: :{__luarocks_rock "rockspec"}'
}
# }}}
# {{{ `new_version` command
@@ -305,14 +305,14 @@ _luarocks_make(){
# - 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'
+ '--tag=[if no version is specified, this option'"'"'s argument is used instead]:TAG:__luarocks_git_tags'
)
_luarocks_new_version(){
- _arguments -A "-*" \
- "${new_version_command_options[@]}" \
- '1:: :{__luarocks_rock "external" "rockspec"}' \
- '2:: :{__luarocks_rock_version "external_or_local"}' \
- '3:: :_urls'
+ _arguments -A "-*" \
+ "${new_version_command_options[@]}" \
+ '1:: :{__luarocks_rock "external" "rockspec"}' \
+ '2:: :{__luarocks_rock_version "external_or_local"}' \
+ '3:: :_urls'
}
# }}}
# {{{ `pack` command
@@ -320,20 +320,20 @@ _luarocks_new_version(){
# - must: .rockspec file / external rock
# - optional: version
_luarocks_pack(){
- _luarocks_build
+ _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)]'
+ '--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)]'
)
_luarocks_path(){
- _arguments "${path_command_options[@]}"
+ _arguments "${path_command_options[@]}"
}
# }}}
# {{{ `purge` command
@@ -341,11 +341,11 @@ _luarocks_path(){
# 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
+ '--old-versions[Keep the highest-numbered version of each rock and remove the other ones]'
+ $option_force
)
_luarocks_purge(){
- _arguments "${purge_command_options[@]}"
+ _arguments "${purge_command_options[@]}"
}
# }}}
# {{{ `remove` command
@@ -354,47 +354,47 @@ _luarocks_purge(){
# - 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
+ $option_deps_mode
+ $option_force
+ $option_force_fast
)
_luarocks_remove(){
- _arguments -A "-*" \
- "${remove_command_options[@]}" \
- '1: :{__luarocks_rock "installed"}' \
- '2:: :{__luarocks_rock_version "installed"}'
+ _arguments -A "-*" \
+ "${remove_command_options[@]}" \
+ '1: :{__luarocks_rock "installed"}' \
+ '2:: :{__luarocks_rock_version "installed"}'
}
# }}}
# {{{ `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]'
+ '--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]'
)
_luarocks_search(){
- _arguments \
- "${search_command_options[@]}" \
- '*:SEARCH QUERY:'
+ _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]'
+ '--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]'
)
_luarocks_show(){
- _arguments \
- "${show_command_options[@]}" \
- '1: :{__luarocks_rock "installed"}'
+ _arguments \
+ "${show_command_options[@]}" \
+ '1: :{__luarocks_rock "installed"}'
}
# }}}
# {{{ `unpack` command
@@ -402,26 +402,26 @@ _luarocks_show(){
# - 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]'
+ '--force[Unpack files even if the output directory already exists]'
)
_luarocks_unpack(){
- _arguments \
- "${unpack_command_options[@]}" \
- '1: :{__luarocks_rock "rockpack" "external"}'
+ _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]'
+ '--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]'
)
_luarocks_upload(){
- _arguments \
- "${upload_command_options[@]}" \
- '1: :{__luarocks_rock "rockspec"}'
+ _arguments \
+ "${upload_command_options[@]}" \
+ '1: :{__luarocks_rock "rockspec"}'
}
# }}}
# {{{ `write_rockspec` command
@@ -431,43 +431,43 @@ _luarocks_upload(){
# - 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]:'
+ '--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]:'
)
_luarocks_write_rockspec(){
- _arguments -A "-*" \
- "${write_rockspec_command_options[@]}" \
- '1:: :{_message "new rock name"}' \
- '2:: :{__luarocks_rock_version "new_rock"}' \
- '3:: :_urls'
+ _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'
+ '(--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
+ (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
diff --git a/src/_pip b/src/_pip
deleted file mode 100644
index cab7fda31..000000000
--- a/src/_pip
+++ /dev/null
@@ -1,326 +0,0 @@
-#compdef pip
-
-# {{{ common options
-local common_options_help=(
- '(- :)'{-h,--help}'[show help]'
-)
-local common_options_pre=(
- '--pre[Include pre-release and development versions]'
-)
-local common_options_install=(
- {\*-c,\*--constraint}'[Constrain versions using the given constraints file]:FILE:_files'
- '(- :)'{-e,--editable}'[Install a project in editable mode (i.e. setuptools "develop mode") from a local project path or a VCS url]:PACKAGE:{__pip_package "url" "file"}'
- {\*-r,\*--requirement}'[Install from the given requirements file]:FILE:_files'
- {-b,--build}'[Directory to unpack packages into and build in]:DIRECTORY:_files -/'
- "--no-deps[Don't install package dependencies]"
- "${common_options_pre[@]}"
- '*--global-option=[Extra global options to be supplied to the setup.py call before the install command]:OPTION:_setup.py'
- '*--no-binary[Do not use binary packages]:FORMAT_CONTROL:__pip_no_binary_control'
- '*--only-binary[Do not use binary packages]:FORMAT_CONTROL:__pip_only_binary_control'
- "--no-clean[Don't clean up build directories]"
- '--require-hashes[Require a hash to check each requirement against, for repeatable installs]'
-)
-local common_options_wheel=(
- "${common_options_install[@]}"
- '--src[Directory to check out editable projects into]:DIRECTORY:_files -/'
- '--ignore-requires-python[Ignore the Requires-Python information]'
-)
-local common_options_index=(
- '(--no-index)'{-i,--index-url}'[Base URL of Python Package Index (default https://pypi.python.org/simple)]:URL:_urls'
- '(--no-index)*--extra-index-url[Extra URLs of package indexes to use in addition to --index-url]:URL:_urls'
- '(-i --index-url)--no-index[Ignore package index (only looking at --find-links URLs instead)]'
- {-f,--find-links}'[If a url or path to an html file, then parse for links to archives]:URL:__pip_find_links'
- '--process-dependency-links[Enable the processing of dependency links]'
-)
-local common_options_user=(
- '--user\[Only output packages installed in user-site\]'
-)
-local common_options_local=(
- {-l,--local}'[If in a virtualenv that has global access, do not output globally-installed packages]'
-)
-# }}}
-# {{{ helper: installed packages cache policy
-__pip_install_packages_cache_policy(){
- # TODO: workout a way that will let users configure via zstyle locations of site-packages
- # the number of seconds since 1970-01-01 the site-packages directories were changed
- local site_packages_user_dir_last_date_modified="$(date -r ~/.local/lib/python3.6/site-packages +%s 2>/dev/null)"
- local site_packages_system_dir_last_date_modified="$(date -r /usr/lib/python3.6/site-packages +%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 "${site_packages_user_dir_last_date_modified}" || ! -z "${site_packages_system_dir_last_date_modified}" ]]; then
- # if the manifest file is newer then the cache:
- if [[ ${site_packages_user_dir_last_date_modified} -ge ${cache_last_date_modified} ]] || [[ ${site_packages_system_dir_last_date_modified} -ge ${cache_last_date_modified} ]]; then
- (( 1 ))
- else
- (( 0 ))
- fi
- else
- (( 1 ))
- fi
-}
-# }}}
-# {{{ helper: installed packages (using cache)
-__pip_installed() {
- local update_policy
- zstyle -s ":completion:${curcontext}:" cache-policy update_policy
- if [[ -z "$update_policy" ]]; then
- zstyle ":completion:${curcontext}:" cache-policy __pip_install_packages_cache_policy
- fi
- if _cache_invalid pip_installed_packages; then
- installed_packages=($(pip list --format freeze | sed -n -e 's/\([-a-z_]\+\)==.*/\1/p'))
- _store_cache pip_installed_packages installed_packages
- else
- _retrieve_cache pip_installed_packages
- fi
- _values "installed packages" "${installed_packages[@]}"
-}
-# }}}
-# {{{ helper: available commands
-local commands=(
- 'install:install packages'
- 'download:download packages'
- 'uninstall:uninstall packages'
- 'freeze:output all currently installed packages (exact versions) to stdout'
- 'list:list installed packages'
- 'show:show information about installed packages'
- 'search:search PyPI'
- 'wheel:build individual wheel archives for your requirements and dependencies'
- 'hash:compute a hash of a local package archive'
- 'help:show available commands'
-)
-__pip_commands(){
- _describe "pip command" commands
-}
-# }}}
-# {{{ helper: installable packages wrapper
-__pip_package(){
- local -a alts
- for arg in "$@"; do
- case $arg in
- "url")
- alts+=(':URL of package:_urls')
- ;;
- "file")
- alts+=(':package repo or archive:_files')
- ;;
- esac
- done
- _alternative "${alts[@]}"
-}
-# }}}
-# {{{ helper: upgrade strategy
-__pip_upgrade_strategy(){
- local strategies=(
- "eager:dependencies are upgraded whether currently installed version satisfies the requirements or not"
- "only-if-needed:are upgraded only when they do not satisfy the requirements of the upgraded package(s)"
- )
- _describe "strategy" strategies
-}
-# }}}
-# {{{ helper: binary control
-__pip_no_binary_control(){
- local options=(
- 'all:"disable all binary packages"'
- 'none:"enable all binary packages"'
- )
- _alternative ": :((${options[@]}))" ": :_message 'packages to install or use:'"
-}
-__pip_only_binary_control(){
- local options=(
- 'all:"enable all binary packages"'
- 'none:"disable all binary packages"'
- )
- _alternative ": :((${options[@]}))" ": :{_message 'packages to install or use:'}"
-}
-# }}}
-# {{{ helper: look for html file or url with links to packages or find packages in a directory
-__pip_find_links(){
- _alternative ': :_urls' ': :_files -g ".html"' ': :_files -/'
-}
-# }}}
-# {{{ helper: urls or files to install
-__pip_install_packages(){
- _alternative ': :_urls' ': :_files'
-}
-# }}}
-# {{{ command install
-local command_install_options=(
- "${common_options_help[@]}"
- "${common_options_wheel[@]}"
- "${common_options_index[@]}"
- {-t,--target}'[Install packages into DIRECTORY]:DIRECTORY:_files -/'
- {-d,--download}"[Download packages into <dir> instead of installing them, regardless of what's already installed]:DIRECTORY:_files -/"
- {-U,--upgrade}'[Upgrade all specified packages to the newest available version]'
- '--upgrade-strategy[Determines how dependency upgrading should be handled]:STRATEGY:__pip_upgrade_strategy'
- '--force-reinstall[When upgrading, reinstall all packages even if they are already up-to-date]'
- {-I,--ignore-installed}'[Ignore the installed packages (reinstalling instead)]'
- # TODO: autoload _setup.py to complete options for it
- '*--install-option=[Extra arguments to be supplied to the setup.py install command]:OPTION:_setup.py'
- '--user[Install to the Python user install directory for your platform]'
- "--egg[Install packages as eggs, not 'flat', like pip normally does]"
- '--root[Install everything relative to this alternate root directory]:DIRECTORY:_files -/'
- '--prefix[Installation prefix where lib, bin and other top-level folders are place]:DIRECTORY:_files -/'
- '--compile[Compile py files to pyc]'
- '--no-compile[Do not compile py files to pyc]'
- '--no-use-wheel[DEPRECATED in favour of --no-binary]'
-)
-_pip_install(){
- _arguments \
- "${command_install_options[@]}" \
- '*:PACKAGE:__pip_install_packages'
-}
-# }}}
-# {{{ command download
-local command_download_options=(
- "${common_options_help[@]}"
- "${common_options_install[@]}"
- "${common_options_index[@]}"
- '--src[Directory to check out editable projects into]:DIRECTORY:_files -/'
- {-d,--dest}'[Download packages into DIRECTORY]:DIRECTORY:_files -/'
- '--platform[Only download wheels compatible with PLATFORM]:PLATFORM:'
- '--python-version[Only download wheels compatible with Python interpreter version VERSION]:VERSION:'
- '--implementation[Only download wheels compatible with Python implementation IMPLEMENTATION]:IMPLEMENTATION:'
- '--abi[Only download wheels compatible with Python abi ABI]:ABI:'
-)
-_pip_download(){
- _arguments \
- "${command_download_options[@]}" \
- '*:PACKAGE:__pip_install_packages'
-}
-# }}}
-# {{{ command uninstall
-local command_uninstall_options=(
- "${common_options_help[@]}"
- {\*-r,\*--requirement}'[Uninstall all the packages listed in the given requirements file]:FILE:_files'
- {-y,--yes}"[Don't ask for confirmation of uninstall deletions]"
-)
-_pip_uninstall(){
- _arguments \
- "${command_uninstall_options[@]}" \
- '*: :__pip_installed'
-}
-# }}}
-# {{{ command freeze
-local command_freeze_options=(
- "${common_options_help[@]}"
- "${common_options_local[@]}"
- "${common_options_user[@]}"
- {\*-r,\*--requirement}'[Use the order in the given requirements file and its comments when generating output]:FILE:_files'
- {-f,--find-links}'[URL for finding packages, which will be added to the output]:URL:_urls'
- '--all[Do not skip these packages in the output: pip, setuptools, distribute, wheel]'
-
-)
-_pip_freeze(){
- _arguments \
- "${command_freeze_options[@]}"
-}
-# }}}
-# {{{ command list
-local command_list_options=(
- "${common_options_help[@]}"
- "${common_options_local[@]}"
- "${common_options_user[@]}"
- "${common_options_pre[@]}"
- {-o,--outdated}'[List outdated packages]'
- {-u,--uptodate}'[List uptodate packages]'
- {-e,--editable}'[List editable projects]'
- '--format[Select the output format among]:FORMAT:(legacy columns freeze json)'
- '--not-required[List packages that are not dependencies of installed packages]'
- "${common_options_index[@]}"
-)
-_pip_list(){
- _arguments \
- "${command_list_options[@]}" \
- '1: :'
-}
-# }}}
-# {{{ command show
-local command_show_options=(
- "${common_options_help[@]}"
- {-f,--files}'[Show the full list of installed files for each package]'
-)
-_pip_show(){
- _arguments \
- "${command_show_options[@]}" \
- '*: :__pip_installed'
-}
-# }}}
-# {{{ command search
-local command_search_options=(
- "${common_options_help[@]}"
- {-i,--index}'[Base URL of Python Package Index (default https://pypi.python.org/pypi)]:URL:_urls'
-)
-_pip_search(){
- _arguments \
- "${command_search_options[@]}" \
- '*:QUERY:'
-}
-# }}}
-# {{{ command wheel
-local command_wheel_options=(
- "${common_options_help[@]}"
- "${common_options_wheel[@]}"
- "${common_options_index[@]}"
- '(--no-wheel-dir)'{-w,--wheel-dir}'[Build wheels into DIRECTORY (default is current working directory)]:DIRECTORY:_files -/'
- '(-w --wheel-dir)--no-wheel-dir[Do not Find and prefer wheel archives when searching indexes and find-links locations]'
-)
-_pip_wheel(){
- _arguments \
- "${command_wheel_options[@]}" \
- '*:PACKAGE:__pip_install_packages'
-}
-# }}}
-# {{{ command hash
-local command_hash_options=(
- "${common_options_help[@]}"
- {-a,--algorithm}'[The hash algorithm to use]:ALGORITHM:(sha256 sha384 sha512)'
-)
-_pip_hash(){
- _arguments \
- "${command_hash_options[@]}" \
- '1:PACKAGE_ARCHIVE:_files'
-}
-# }}}
-# {{{ command help
-local command_help_options=(
- "${common_options_help[@]}"
-)
-_pip_help(){
- _arguments \
- "${command_help_options[@]}" \
- '1:COMMAND:__pip_commands'
-}
-# }}}
-
-# The real thing
-_arguments \
- "${common_options_help[@]}" \
- '--isolated[run pip in isolated mode, ignores environment variables and user configuration]' \
- {-v,--verbose}'[give more output]' \
- {-V,--version}'[show version number of program and exit]' \
- {-q,--quiet}'[give less output]' \
- '--log[log file location]' \
- '--proxy=[proxy in form user:passwd@proxy.server:port]' \
- '--retries=[max number of retries per connection (default 5 times)]' \
- '--timeout=[socket timeout (default 15s)]' \
- '--exists-action=[default action when a path already exists: (s)witch, (i)gnore, (w)ipe, (b)ackup]' \
- '--trusted-host=[mark this host as trusted]' \
- '--cert=[path to alternate CA bundle]' \
- '--client-cert=[path to SSL client certificate]' \
- '--cache-dir=[store the cache data in specified directory]' \
- '--no-cache-dir[disable de cache]' \
- '--disable-pip-version-check[do not check periodically for new pip version downloads]' \
- {-E,--environment}'[virtualenv environment to run pip in (deprecated)]' \
- {-s,--enable-site-packages}'[include site-packages in virtualenv (deprecated)]' \
- '1: :__pip_commands' \
- '*::arg:->args'
-
-case "$state" in
- (args)
- curcontext="${curcontext%:*:*}:pip_${words[1]}:"
- # check if a command with a defined completion was typed
- type _pip_${words[1]} &> /dev/null
- if [[ $? != 1 ]]; then
- _pip_${words[1]}
- fi
-esac
--
2.17.0
Messages sorted by:
Reverse Date,
Date,
Thread,
Author