138 |
--passwordbox "${text}" "${height}" "${width}" |
--passwordbox "${text}" "${height}" "${width}" |
139 |
} |
} |
140 |
|
|
141 |
|
menubox() |
142 |
|
{ |
143 |
|
local header |
144 |
|
local text |
145 |
|
local height |
146 |
|
local width |
147 |
|
local items |
148 |
|
local index |
149 |
|
local dialog_opts |
150 |
|
|
151 |
|
# very basic getops |
152 |
|
local OPTIND opt |
153 |
|
while getopts ":h:y:x:i:n" opt |
154 |
|
do |
155 |
|
case ${opt} in |
156 |
|
n) dialog_opts+=" --no-cancel" ;; |
157 |
|
h) header="${OPTARG}" ;; |
158 |
|
y) height="${OPTARG}" ;; |
159 |
|
x) width="${OPTARG}" ;; |
160 |
|
esac |
161 |
|
done |
162 |
|
shift $((OPTIND-1)) |
163 |
|
text="$1" |
164 |
|
shift |
165 |
|
items=( "$@" ) |
166 |
|
index="${#items[*]}" |
167 |
|
|
168 |
|
#[[ -z ${header} ]] && header="empty header: add -h yourheader" |
169 |
|
[[ -z ${text} ]] && die "no text given" |
170 |
|
[[ -z ${height} ]] && height=0 |
171 |
|
[[ -z ${width} ]] && width=70 |
172 |
|
|
173 |
|
[[ -z ${OK_LABEL} ]] && OK_LABEL="Next" |
174 |
|
[[ -z ${CANCEL_LABEL} ]] && CANCEL_LABEL="Back" |
175 |
|
|
176 |
|
eval dialog \ |
177 |
|
--stdout \ |
178 |
|
--colors \ |
179 |
|
--title "'${header}'" \ |
180 |
|
--backtitle "'${TITLE}'" \ |
181 |
|
--ok-label "'${OK_LABEL}'" \ |
182 |
|
--cancel-label "'${CANCEL_LABEL}'" \ |
183 |
|
"${dialog_opts}" \ |
184 |
|
--menu "'${text}'" "${height}" "${width}" "${index}" \ |
185 |
|
$(for ((i=0;i<index;i++)); do echo "'${items[${i}]%%:*}'";echo "'${items[${i}]#*:}'"; done) |
186 |
|
} |
187 |
|
|
188 |
gaugebox() |
gaugebox() |
189 |
{ |
{ |
190 |
local header |
local header |