From fb6589f23f195115f4b15028f32e03e53b994f4e Mon Sep 17 00:00:00 2001 From: Nuri Jung Date: Tue, 12 Mar 2024 20:49:43 +0900 Subject: [PATCH 1/3] fix: silence file not found --- _conda | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/_conda b/_conda index 09bab01..1ae94da 100644 --- a/_conda +++ b/_conda @@ -204,7 +204,7 @@ __conda_envs(){ # unmaned envs (if show-unammed). if test -n "$unnamed"; then - envs+=($( (test -n "$unnamed" && cat ${HOME:?}/.conda/environments.txt) | cut -f1 -d' ' | sed -e "s|^${PWD}|.|" | sed -e "s|^$localenvspath/||")) + envs+=($( (cat ${HOME:?}/.conda/environments.txt) 2>/dev/null | cut -f1 -d' ' | sed -e "s|^${PWD}|.|" | sed -e "s|^$localenvspath/||")) fi _describe $describe_opts -t envs 'conda environments' envs @@ -746,4 +746,3 @@ case $state in esac ;; esac - From 05a74fb90716e23bab42d640abef2ce6cf3022dd Mon Sep 17 00:00:00 2001 From: Nuri Jung Date: Tue, 12 Mar 2024 21:09:04 +0900 Subject: [PATCH 2/3] feat: update conda completion to support newer conda versions --- _conda | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/_conda b/_conda index 1ae94da..fbea65a 100644 --- a/_conda +++ b/_conda @@ -703,18 +703,19 @@ case $state in (create) _arguments -C $help_opts \ $json_opts \ - '(-n --name)'{-n,--name}'[name of environment]:environment:__conda_envs' \ + $env_opts \ '(-f --file)'{-f,--file}'[environment definition]:file:_path_files' \ '(-q --quiet)'{-q,--quiet}'[]' \ ;; (export) _arguments -C $help_opts \ - '(-n --name)'{-n,--name}'[name of environment]:environment:__conda_envs' \ + $env_opts \ '(-f --file)'{-f,--file}'[]:file:_path_files' \ ;; (list) _arguments -C $help_opts \ $json_opts \ + $env_opts ;; (remove) _arguments -C $help_opts \ @@ -727,7 +728,7 @@ case $state in (update) _arguments -C $help_opts \ $json_opts \ - '(-n --name)'{-n,--name}'[name of environment]:environment:__conda_envs' \ + $env_opts \ '(-f --file)'{-f,--file}'[environment definition]:file:_path_files' \ '(-q --quiet)'{-q,--quiet}'[]' \ ;; @@ -738,7 +739,7 @@ case $state in (activate) _arguments -C $help_opts \ '--stack[activate this environment on top of the previous environment]' \ - '*:environment:__conda_envs' + '*:environment:{__conda_envs; _path_files}' ;; (deactivate) _arguments -C $help_opts \ From 1f9a7f2668530fe9d9afb6491bedf3ffabbac295 Mon Sep 17 00:00:00 2001 From: Nuri Jung Date: Tue, 12 Mar 2024 21:18:51 +0900 Subject: [PATCH 3/3] feat: list only directories for prefixes --- _conda | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/_conda b/_conda index fbea65a..733c691 100644 --- a/_conda +++ b/_conda @@ -462,7 +462,7 @@ json_opts=( env_opts=( '(-n --name -p --prefix)'{-n,--name}'[name of environment]:environment:__conda_envs' \ - '(-n --name -p --prefix)'{-p,--prefix}'[full path to environment prefix]:path:_path_files' \ + '(-n --name -p --prefix)'{-p,--prefix}'[full path to environment prefix]:prefix:_directories' \ ) channel_opts=( @@ -739,7 +739,7 @@ case $state in (activate) _arguments -C $help_opts \ '--stack[activate this environment on top of the previous environment]' \ - '*:environment:{__conda_envs; _path_files}' + '*:environment:{__conda_envs; _directories}' ;; (deactivate) _arguments -C $help_opts \