Skip to content

Commit ca2f869

Browse files
committed
[update] : Added --line
1 parent 9095872 commit ca2f869

1 file changed

Lines changed: 13 additions & 3 deletions

File tree

tools/channel.sh

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ opt_nochkver=false
99
opt_nobuiltin=false
1010
opt_fullpath=false
1111
opt_nocheck=false
12+
opt_line=false
1213
alteriso_version="3.1"
1314
mode=""
1415
arch="all"
@@ -38,6 +39,7 @@ _help() {
3839
echo " -h | --help This help message"
3940
echo
4041
echo " --nocheck Do not check the channel with desc command.This option helps speed up."
42+
echo " --line Line break the output"
4143
echo
4244
echo " check command exit code"
4345
echo " 0 (correct) Normal available channel"
@@ -164,22 +166,26 @@ desc() {
164166
show() {
165167
gen_channel_list
166168
if (( "${#channellist[*]}" > 0)); then
167-
echo "${channellist[*]}"
169+
if [[ "${opt_line}" = true ]]; then
170+
printf "%s\n" "${channellist[@]}"
171+
else
172+
echo "${channellist[*]}"
173+
fi
168174
fi
169175
}
170176

171177

172178
# Parse options
173179
OPTS="a:bdfk:nov:h"
174-
OPTL="arch:,nobuiltin,dirname,fullpath,kernel:,only-add,nochkver,version:,help,nocheck"
180+
OPTL="arch:,nobuiltin,dirname,fullpath,kernel:,only-add,nochkver,version:,help,nocheck,line"
175181
if ! OPT=$(getopt -o ${OPTS} -l ${OPTL} -- "${@}"); then
176182
exit 1
177183
fi
178184
eval set -- "${OPT}"
179185
unset OPT OPTS OPTL
180186

181187
while true; do
182-
case ${1} in
188+
case "${1}" in
183189
-a | --arch)
184190
arch="${2}"
185191
shift 2
@@ -220,6 +226,10 @@ while true; do
220226
opt_nocheck=true
221227
shift 1
222228
;;
229+
--line)
230+
opt_line=true
231+
shift 1
232+
;;
223233
--)
224234
shift 1
225235
break

0 commit comments

Comments
 (0)