more refactoring

This commit is contained in:
Valentin Haenel
2015-02-11 13:15:07 +01:00
parent 451b285db8
commit 8260ef5ae1

47
_conda
View File

@@ -88,17 +88,24 @@ help_opts=(
'(-h --help)'{-h,--help}'[show the help message and exit]' \
)
json_opts=(
'--json[report all output as json.]' \
)
base_opts=(
env_opts=(
'(-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]' \
)
channel_opts=(
'(-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-index-cache[use cache of channel index files]' \
'--use-local[use locally built packages]' \
)
base_opts=(
)
install_opts=(
'(-y --yes)'{-y,--yes}'[do not ask for confirmation]' \
'--dry-run[only display what would have been done]' \
@@ -134,9 +141,8 @@ case $state in
;;
(list)
_arguments -C $help_opts \
'(-n --name=)'{-n,--name=}'[install into given conda environment]:environment:__conda_envs' \
'(-p --prefix)'{-p,--prefix}'[full path to environment prefix]:path:_path_files' \
'--json[report all output as json.]' \
$env_opts \
$json_opts \
'(-c --canonical)'{-c,--canonical}'[output canonical names of packages only]' \
'(-e --export)'{-e,--export}'[output requirement string only]' \
'(-r --revisions)'{-r,--revision}'[list the revision history and exit]' \
@@ -146,7 +152,11 @@ case $state in
(search)
_arguments -C $help_opts \
$base_opts \
$env_opts \
$json_opts \
$channel_opts \
'(-c --canonical)'{-c,--canonical}'[output canonical names of packages only]' \
'--unknown[use index metadata from the local package cache]' \
'(-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.]' \
@@ -154,24 +164,41 @@ case $state in
'*:regex:' \
;;
(create)
_arguments -C $base_opts \
_arguments -C $help_opts \
$base_opts \
$env_opts \
$install_opts \
$json_opts \
$channel_opts \
'--clone[path to (or name of) existing local environment]' \
'--no-default-packages[ignore create_default_packages in condarc file]' \
'*:packages:__conda_packages_search' \
;;
(install)
_arguments -C $base_opts \
_arguments -C $help_opts \
$base_opts \
$env_opts \
$install_opts \
$json_opts \
$channel_opts \
'--revision[revert to the specified revision]:revision' \
'*:packages:__conda_packages_search' \
;;
(update)
_arguments -C $base_opts \
_arguments -C $help_opts \
$base_opts \
$env_opts \
$install_opts \
$json_opts \
$channel_opts \
'--all[Update all installed packages in the environment]' \
'*:packages:__conda_packages_installed' \
;;
(remove)
_arguments -C $help_opts \
$env_opts \
$json_opts \
$channel_opts \
(*)
#_arguments -C $opts
_path_files