1 |
Author: ulm |
2 |
Date: 2009-04-21 17:18:37 +0000 (Tue, 21 Apr 2009) |
3 |
New Revision: 484 |
4 |
|
5 |
Modified: |
6 |
trunk/ChangeLog |
7 |
trunk/bin/eselect.in |
8 |
trunk/modules/modules.eselect |
9 |
Log: |
10 |
Fix quoting. |
11 |
|
12 |
Modified: trunk/ChangeLog |
13 |
=================================================================== |
14 |
--- trunk/ChangeLog 2009-04-21 08:21:47 UTC (rev 483) |
15 |
+++ trunk/ChangeLog 2009-04-21 17:18:37 UTC (rev 484) |
16 |
@@ -1,5 +1,7 @@ |
17 |
2009-04-21 Ulrich Mueller <ulm@g.o> |
18 |
|
19 |
+ * modules/modules.eselect (do_list, do_has): Fix quoting. |
20 |
+ |
21 |
* modules/compiler.eselect.in: Remove dead module. |
22 |
|
23 |
* modules/rc.eselect (do_show): Add --all option. |
24 |
|
25 |
Modified: trunk/bin/eselect.in |
26 |
=================================================================== |
27 |
--- trunk/bin/eselect.in 2009-04-21 08:21:47 UTC (rev 483) |
28 |
+++ trunk/bin/eselect.in 2009-04-21 17:18:37 UTC (rev 484) |
29 |
@@ -153,11 +153,11 @@ |
30 |
|
31 |
if [[ -z ${action} ]] && [[ -n ${1##--} ]] ; then |
32 |
while [[ ${1##--} != ${1} ]] ; do |
33 |
- has ${1##--} "${ESELECT_KNOWN_OPTIONS[@]}" || \ |
34 |
+ has ${1##--} ${ESELECT_KNOWN_OPTIONS} || \ |
35 |
die -q "Unknown option ${1}!" |
36 |
case ${1##--} in |
37 |
no-colour|no-color) |
38 |
- ESELECT_OPTIONS=(${ESELECT_OPTIONS[@]} "NOCOLOUR") |
39 |
+ ESELECT_OPTIONS="${ESELECT_OPTIONS} NOCOLOUR" |
40 |
nocolours |
41 |
;; |
42 |
help|version) |
43 |
|
44 |
Modified: trunk/modules/modules.eselect |
45 |
=================================================================== |
46 |
--- trunk/modules/modules.eselect 2009-04-21 08:21:47 UTC (rev 483) |
47 |
+++ trunk/modules/modules.eselect 2009-04-21 17:18:37 UTC (rev 484) |
48 |
@@ -13,14 +13,14 @@ |
49 |
|
50 |
### list action |
51 |
|
52 |
-## {{{ list |
53 |
- |
54 |
describe_list() { |
55 |
echo "List all available modules" |
56 |
} |
57 |
|
58 |
# List all installed modules |
59 |
do_list() { |
60 |
+ [[ $# -gt 0 ]] && die -q "Too many parameters" |
61 |
+ |
62 |
local path file module name desc |
63 |
|
64 |
write_list_start "Built-in modules:" |
65 |
@@ -31,16 +31,16 @@ |
66 |
extra_modules=() |
67 |
for path in "${ESELECT_MODULES_PATH[@]}" ; do |
68 |
[[ -d ${path} ]] || continue |
69 |
- for file in ${path}/*.eselect ; do |
70 |
+ for file in "${path}"/*.eselect ; do |
71 |
[[ -f ${file} ]] || continue |
72 |
- extra_modules=( ${extra_modules[@]} "${file}" ) |
73 |
+ extra_modules=( "${extra_modules[@]}" "${file}" ) |
74 |
done |
75 |
done |
76 |
|
77 |
if [[ ${#extra_modules[@]} -gt 0 ]] ; then |
78 |
echo |
79 |
write_list_start "Extra modules:" |
80 |
- for module in ${extra_modules[@]} ; do |
81 |
+ for module in "${extra_modules[@]}" ; do |
82 |
name=${module##*/} |
83 |
name=${name%%.eselect} |
84 |
desc=$(load_config "${module}" DESCRIPTION) |
85 |
@@ -50,11 +50,8 @@ |
86 |
fi |
87 |
} |
88 |
|
89 |
-# }}} |
90 |
- |
91 |
### has action |
92 |
|
93 |
-## {{{ has |
94 |
describe_has() { |
95 |
echo "Return true if the module is installed, and false otherwise" |
96 |
} |
97 |
@@ -64,22 +61,21 @@ |
98 |
} |
99 |
|
100 |
do_has() { |
101 |
- local modname="$1" modpath |
102 |
- [[ -z "$modname" ]] && die -q "Required option (module name) missing" |
103 |
+ [[ -z $1 ]] && die -q "Required option (module name) missing" |
104 |
+ [[ $# -gt 1 ]] && die -q "Too many parameters" |
105 |
+ |
106 |
+ local modname=$1 modpath |
107 |
for modpath in "${ESELECT_MODULES_PATH[@]}" ; do |
108 |
- [[ -f "${modpath}/${modname}.eselect" ]] && return 0 |
109 |
+ [[ -f ${modpath}/${modname}.eselect ]] && return 0 |
110 |
done |
111 |
return 1 |
112 |
} |
113 |
-## }}} |
114 |
|
115 |
### add action |
116 |
# *** Commented out. Do we really want to have an eselect module that is |
117 |
# *** installing other modules in a system directory? Also, this should |
118 |
# *** go together with a "remove" action. |
119 |
|
120 |
-## {{{ add |
121 |
- |
122 |
# describe_add() { |
123 |
# echo "Install the given module file somewhere that eselect can find it." |
124 |
# echo "By default, install to \$HOME/.eselect/modules/, unless running as " |
125 |
@@ -94,13 +90,13 @@ |
126 |
# local local_path="${ROOT}${HOME}/.eselect/modules/" module_file |
127 |
# local force_default=0 |
128 |
# |
129 |
-# if [[ ${1} == "--force-default-location" ]] ; then |
130 |
+# if [[ $1 = "--force-default-location" ]] ; then |
131 |
# force_default=1 |
132 |
# shift |
133 |
# fi |
134 |
-# module_file=${1} |
135 |
+# module_file=$1 |
136 |
# |
137 |
-# [[ -z "${module_file}" ]] && die -q "Required option (module file) missing" |
138 |
+# [[ -z ${module_file} ]] && die -q "Required option (module file) missing" |
139 |
# |
140 |
# # TODO: Don't install the module "somewhere", depending on write access. |
141 |
# # Add an option to control if it goes to the user's or to the system dir. |
142 |
@@ -115,6 +111,4 @@ |
143 |
# fi |
144 |
# } |
145 |
|
146 |
-## }}} |
147 |
- |
148 |
# vim: ts=4 sw=4 noet fdm=marker |