1 |
commit: 9737be28efe8cf3668d4f0625382f9184db4c49a |
2 |
Author: Vadim A. Misbakh-Soloviov <git <AT> mva <DOT> name> |
3 |
AuthorDate: Tue Apr 28 14:55:39 2015 +0000 |
4 |
Commit: Vadim A. Misbakh-Soloviov <mva <AT> mva <DOT> name> |
5 |
CommitDate: Tue Apr 28 14:55:39 2015 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/zsh-completion.git/commit/?id=9737be28 |
7 |
|
8 |
_gentoo_repos: some algo rework. Probably fixes #3 |
9 |
|
10 |
Signed-off-by: Vadim A. Misbakh-Soloviov <git <AT> mva.name> |
11 |
|
12 |
src/_gentoo_repos | 21 ++++++++++++++------- |
13 |
1 file changed, 14 insertions(+), 7 deletions(-) |
14 |
|
15 |
diff --git a/src/_gentoo_repos b/src/_gentoo_repos |
16 |
index 7f88a64..85f3936 100644 |
17 |
--- a/src/_gentoo_repos |
18 |
+++ b/src/_gentoo_repos |
19 |
@@ -6,9 +6,12 @@ |
20 |
# _gentoo_repos -o -> returns the list of non-main repos |
21 |
|
22 |
_gentoo_repos() { |
23 |
- local main_repo main_repo_path overlay overlay_paths |
24 |
+ local main_repo main_repo_path overlay overlay_paths result |
25 |
|
26 |
- if [[ -e /usr/share/portage/config/repos.conf ]]; then |
27 |
+ overlay_paths=(); |
28 |
+ result=(); |
29 |
+ |
30 |
+ if [[ -e /usr/share/portage/config/repos.conf || -e /etc/portage/repos.conf ]]; then |
31 |
main_repo=$(_repos_conf DEFAULT main-repo) |
32 |
main_repo_path=$(_repos_conf ${main_repo} location) |
33 |
|
34 |
@@ -30,16 +33,20 @@ _gentoo_repos() { |
35 |
fi |
36 |
|
37 |
if [[ $1 == "-m" ]]; then |
38 |
- echo "${main_repo_path}" |
39 |
+ result+=(${main_repo_path}) |
40 |
elif [[ $1 == "-o" ]]; then |
41 |
- echo "${(@u)overlay_paths}" |
42 |
+ result+=(${(@)overlay_paths}) |
43 |
else |
44 |
- echo "${main_repo_path} ${(@u)overlay_paths}" |
45 |
+ result+=(${main_repo_path} ${(@)overlay_paths}) |
46 |
fi |
47 |
+ |
48 |
+ echo ${(u)result} |
49 |
} |
50 |
|
51 |
_repos_conf() { |
52 |
- local v file insection section arr |
53 |
+ local v file insection section arr secname |
54 |
+ |
55 |
+ secname=(); |
56 |
|
57 |
for file in /usr/share/portage/config/repos.conf \ |
58 |
/etc/portage/repos.conf \ |
59 |
@@ -74,7 +81,7 @@ _repos_conf() { |
60 |
done |
61 |
|
62 |
if [[ ${1} == "-l" ]]; then |
63 |
- echo "${(@)secname}" |
64 |
+ echo "${(@u)secname}" |
65 |
else |
66 |
echo "${v}" |
67 |
fi |