mirror of
https://github.com/conda-incubator/conda-zsh-completion.git
synced 2026-03-04 06:14:59 +08:00
refactoring for reuse
This commit is contained in:
37
_conda
37
_conda
@@ -84,27 +84,29 @@ _arguments -C $opts \
|
||||
': :->command' \
|
||||
'*:: :->subcmd'
|
||||
|
||||
install_opts=(
|
||||
base_opts=(
|
||||
'(-h --help)'{-h,--help}'[show the help message and exit]' \
|
||||
'(-n --name=)'{-n,--name=}'[name of environment]:environment:__conda_envs' \
|
||||
'(-p --prefix)'{-p,--prefix}'[full path to environment prefix]:path:_path_files' \
|
||||
'--unknown[use index metadata from the local package cache]' \
|
||||
'--use-index-cache[use cache of channel index files]' \
|
||||
'(-c --channel)'{-c,--channel}'[additional channel to search for packages]:channel:__conda_channels'\
|
||||
'--override-channels [do not search default or .condarc channels]' \
|
||||
'--json[report all output as json.]' \
|
||||
'--use-local[use locally built packages]' \
|
||||
)
|
||||
install_opts=(
|
||||
'(-y --yes)'{-y,--yes}'[do not ask for confirmation]' \
|
||||
'--dry-run[only display what would have been done]' \
|
||||
'(-f --force)'{-f,--force}'[force install]' \
|
||||
'--file[read package versions from file]:file:_path_files' \
|
||||
'--unknown[use index metadata from the local package cache]' \
|
||||
'--no-deps[do not install dependencies]' \
|
||||
'(-m --mkdir)'{-m,--mkdir}'[create prefix directory if necessary]' \
|
||||
'--use-index-cache[use cache of channel index files]' \
|
||||
'--use-local[use locally built packages]' \
|
||||
'--offline[offline mode, don''t connect to internet]' \
|
||||
'--no-pin[ignore pinned file]' \
|
||||
'(-c --channel)'{-c,--channel}'[additional channel to search for packages]:channel:__conda_channels'\
|
||||
'--override-channels [do not search default or .condarc channels]' \
|
||||
'(-n --name=)'{-n,--name=}'[install into given conda environment]:environment:__conda_envs' \
|
||||
'(-p --prefix)'{-p,--prefix}'[full path to environment prefix]:path:_path_files' \
|
||||
'(-q --quiet)'{-q,--quiet}'[do not display progress bar]'\
|
||||
'--copy[Install all packages using copies instead of hard- or soft-linking]' \
|
||||
'--alt-hint[Use an alternate algorithm to generate an unsatisfiable hint]' \
|
||||
'--json[report all output as json.]' \
|
||||
)
|
||||
|
||||
case $state in
|
||||
@@ -114,7 +116,8 @@ case $state in
|
||||
(subcmd)
|
||||
case ${line[1]} in
|
||||
(install)
|
||||
_arguments -C $install_opts \
|
||||
_arguments -C $base_opts \
|
||||
$install_opts \
|
||||
'--revision[revert to the specified revision]:revision' \
|
||||
'*:packages:__conda_packages_search' \
|
||||
;;
|
||||
@@ -130,25 +133,17 @@ case $state in
|
||||
'*:regex:' \
|
||||
;;
|
||||
(search)
|
||||
_arguments -C '(-h --help)'{-h,--help}'[show the help message and exit]' \
|
||||
'(-n --name=)'{-n,--name=}'[name of environment]:environment:__conda_envs' \
|
||||
'(-p --prefix)'{-p,--prefix}'[full path to environment prefix]:path:_path_files' \
|
||||
_arguments -C $base_opts \
|
||||
'(-c --canonical)'{-c,--canonical}'[output canonical names of packages only]' \
|
||||
'--unknown[use index metadata from the local package cache]' \
|
||||
'--use-index-cache[use cache of channel index files]' \
|
||||
'(-c --channel)'{-c,--channel}'[additional channel to search for packages]:channel:__conda_channels'\
|
||||
'--override-channels [do not search default or .condarc channels]' \
|
||||
'--json[report all output as json.]' \
|
||||
'(-o --outdated)'{-o,--outdated}'[only display installed but outdated packages]' \
|
||||
'(-v --verbose)'{-v,--verbose}'[Show available packages as blocks of data]' \
|
||||
'--platform[Search the given platform.]' \
|
||||
'--spec[Treat regex argument as a package specification]' \
|
||||
'--json[report all output as json.]' \
|
||||
'--use-local[use locally built packages]' \
|
||||
'*:regex:' \
|
||||
;;
|
||||
(update)
|
||||
_arguments -C $install_opts \
|
||||
_arguments -C $base_opts \
|
||||
$install_opts \
|
||||
'--all[Update all installed packages in the environment]' \
|
||||
'*:packages:__conda_packages_installed' \
|
||||
;;
|
||||
|
||||
Reference in New Issue
Block a user