mirror of
https://github.com/ail-project/ail-framework.git
synced 2024-11-30 09:47:17 +00:00
Allow for multiple entries like 1 2 3 4 5
Should replace the need to type 1<Enter>2<Enter> etc. and allows for 1 2 3 4 5<Enter>
This commit is contained in:
parent
71922f9def
commit
3105192312
1 changed files with 8 additions and 6 deletions
|
@ -239,13 +239,15 @@ menu() {
|
||||||
}
|
}
|
||||||
|
|
||||||
prompt="Check an option (again to uncheck, ENTER when done): "
|
prompt="Check an option (again to uncheck, ENTER when done): "
|
||||||
while menu && read -rp "$prompt" num && [[ "$num" ]]; do
|
while menu && read -rp "$prompt" numinput && [[ "$numinput" ]]; do
|
||||||
|
for num in $numinput; do
|
||||||
[[ "$num" != *[![:digit:]]* ]] && (( num > 0 && num <= ${#options[@]} )) || {
|
[[ "$num" != *[![:digit:]]* ]] && (( num > 0 && num <= ${#options[@]} )) || {
|
||||||
msg="Invalid option: $num"; continue
|
msg="Invalid option: $num"; break
|
||||||
}
|
}
|
||||||
((num--)); msg="${options[num]} was ${choices[num]:+un}checked"
|
((num--)); msg="${options[num]} was ${choices[num]:+un}checked"
|
||||||
[[ "${choices[num]}" ]] && choices[num]="" || choices[num]="+"
|
[[ "${choices[num]}" ]] && choices[num]="" || choices[num]="+"
|
||||||
done
|
done
|
||||||
|
done
|
||||||
|
|
||||||
for i in ${!options[@]}; do
|
for i in ${!options[@]}; do
|
||||||
if [[ "${choices[i]}" ]]; then
|
if [[ "${choices[i]}" ]]; then
|
||||||
|
|
Loading…
Reference in a new issue