diff options
author | Tim Harder <radhermit@gentoo.org> | 2014-12-20 14:27:43 -0800 |
---|---|---|
committer | Tim Harder <radhermit@gentoo.org> | 2014-12-20 14:27:43 -0800 |
commit | fabda847f4690cac36728ec8372f4fe82a8ba9f1 (patch) | |
tree | 5fcd8d9aae3aa5e31b53afb78da2629feb577def /src/_gentoo_repos | |
parent | _gentoo_repos: use more apt variable names (diff) | |
download | zsh-completion-fabda847f4690cac36728ec8372f4fe82a8ba9f1.tar.gz zsh-completion-fabda847f4690cac36728ec8372f4fe82a8ba9f1.tar.bz2 zsh-completion-fabda847f4690cac36728ec8372f4fe82a8ba9f1.zip |
_gentoo_repos: drop duplicated output functionality
Also, calling _gentoo_repos with no arguments returns all configured
repos instead of just the main repo. To get the path for the main repo
use `_gentoo_repos -m`.
Diffstat (limited to 'src/_gentoo_repos')
-rw-r--r-- | src/_gentoo_repos | 44 |
1 files changed, 22 insertions, 22 deletions
diff --git a/src/_gentoo_repos b/src/_gentoo_repos index 3419cdc..7f88a64 100644 --- a/src/_gentoo_repos +++ b/src/_gentoo_repos @@ -1,40 +1,40 @@ #autoload # Usage: -# _gentoo_repos -> returns the main repo (with PORTDIR fallback) -# _gentoo_repos -o -> returns the list of non-main repos (with PORTDIR_OVERLAY fallback) +# _gentoo_repos -> returns the list of all repos +# _gentoo_repos -m -> returns the main repo +# _gentoo_repos -o -> returns the list of non-main repos _gentoo_repos() { - local main_repo main_repo_path overlay overlay_path + local main_repo main_repo_path overlay overlay_paths if [[ -e /usr/share/portage/config/repos.conf ]]; then - if [[ ${1} == "-o" ]]; then - for overlay in $(_repos_conf -l); do - overlay_path+=($(_repos_conf ${overlay} location)) - done + main_repo=$(_repos_conf DEFAULT main-repo) + main_repo_path=$(_repos_conf ${main_repo} location) - source /etc/make.conf 2>/dev/null - source /etc/portage/make.conf 2>/dev/null + for overlay in $(_repos_conf -l); do + overlay_paths+=($(_repos_conf ${overlay} location)) + done - overlay_path+=(${(@)PORTDIR_OVERLAY}) - - echo "${(@u)overlay_path}" - else - main_repo=$(_repos_conf DEFAULT main-repo) - main_repo_path=$(_repos_conf ${main_repo} location) + source /etc/make.conf 2>/dev/null + source /etc/portage/make.conf 2>/dev/null - echo "${main_repo_path}" - fi + overlay_paths+=(${(@)PORTDIR_OVERLAY}) else source /usr/share/portage/config/make.globals 2>/dev/null source /etc/make.conf 2>/dev/null source /etc/portage/make.conf 2>/dev/null - if [[ ${1} == "-o" ]]; then - echo "${(@u)PORTDIR_OVERLAY}" - else - echo "${PORTDIR}" - fi + main_repo_path="${PORTDIR}" + overlay_paths=(${(@)PORTDIR_OVERLAY}) + fi + + if [[ $1 == "-m" ]]; then + echo "${main_repo_path}" + elif [[ $1 == "-o" ]]; then + echo "${(@u)overlay_paths}" + else + echo "${main_repo_path} ${(@u)overlay_paths}" fi } |