From ab7bce3f7921c877dfdb44e86c4f3bc4ea99e704 Mon Sep 17 00:00:00 2001 From: Valentin Haenel Date: Tue, 10 Feb 2015 16:14:11 +0100 Subject: [PATCH] refactor install opts --- _conda | 48 ++++++++++++++++++++++++++++-------------------- 1 file changed, 28 insertions(+), 20 deletions(-) diff --git a/_conda b/_conda index 7472c2b..cfc6b26 100644 --- a/_conda +++ b/_conda @@ -78,6 +78,29 @@ _arguments -C $opts \ ': :->command' \ '*:: :->subcmd' + +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 (command) __conda_commands @@ -85,27 +108,9 @@ case $state in (subcmd) case ${line[1]} in (install) - _arguments -C '(-n --name=)'{-n,--name=}'[install into given conda environment]:environment:__conda_envs' \ - '(-h --help)'{-h,--help}'[show the help message and exit]' \ + _arguments -C '(-h --help)'{-h,--help}'[show the help message and exit]' \ + $install_opts \ '--revision[revert to the specified revision]:revision' \ - '(-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]' \ - '(-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.]' \ '*:packages:__conda_packages_search' \ ;; (list) @@ -119,6 +124,9 @@ case $state in '--no-pip[Do not include pip-only installed packages]' \ '*:regex:' \ ;; + (update) + _arguments -C $install_opts + ;; (help) _arguments -C '(-h --help)'{-h,--help}'[show the help message and exit]' \ '*:commands:__conda_commands' \