refactor boolean and list keys

This commit is contained in:
Valentin Haenel
2015-02-14 17:21:14 +01:00
parent 8756657d23
commit 7c63b94ce2

55
_conda
View File

@@ -131,28 +131,43 @@ __conda_channels(){
_describe -t channels 'conda channels' channels
}
config_options=('channels'
'disallow'
'create_default_packages'
'track_features'
'envs_dirs'
'add_binstar_token'
'always_yes'
'allow_softlinks'
'changeps1'
'use_pip'
'offline'
'binstar_upload'
'binstar_personal'
'show_channel_urls'
'allow_other_channels'
'ssl_verify'
)
boolean_config_options=(
'add_binstar_token'
'always_yes'
'allow_softlinks'
'changeps1'
'use_pip'
'offline'
'binstar_upload'
'binstar_personal'
'show_channel_urls'
'allow_other_channels'
'ssl_verify'
)
list_config_options=(
'channels'
'disallow'
'create_default_packages'
'track_features'
'envs_dirs'
)
__boolean_conda_config(){
_describe -t boolean_config_options 'boolean keys' boolean_config_options
}
__list_conda_config(){
_describe -t list_config_options 'list keys' list_config_options
}
config_options=($boolean_config_options $list_config_options)
__conda_config(){
_describe -t config_options 'conda configuration' config_options
_describe -t config_options 'conda configuration keys' config_options
}
__conda_commands(){
local -a package maint environment help config special
package=(
@@ -339,8 +354,8 @@ case $state in
'--system[write to the system .condarc file]' \
'--file[write to the given file.]:file:_path_files' \
'( --add --set --remove --remove-key)--get[get the configuration value]:key:__conda_config' \
'(--get --set --remove --remove-key)--add[add one configuration value to a list key]:key:__conda_config:value:' \
'(--get --add --remove --remove-key)--set[set a boolean key]:key:__conda_config:value:' \
'(--get --set --remove --remove-key)--add[add one configuration value to a list key]:key:__list_conda_config:value:' \
'(--get --add --remove --remove-key)--set[set a boolean key]:key:__boolean_conda_config:value:' \
'(--get --add --set --remove-key)--remove[remove a configuration value from a list key]:key:__conda_config:value:{__conda_config_values_describe '$last_item'}' \
'(--get --add --set --remove )--remove-key[remove a configuration key (and all its values)]:key:__conda_config' \
'(-f --force)'{-f,--force}'[write to the config file using the yaml parser]' \