Skip to content

Commit

Permalink
TAPTUI: some improvements to mappings and amiibo ui elements.
Browse files Browse the repository at this point in the history
  • Loading branch information
sigboe committed May 19, 2024
1 parent 22b5eb1 commit dc026b3
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions scripts/taptui/taptui.sh
Original file line number Diff line number Diff line change
Expand Up @@ -1358,11 +1358,13 @@ _editMapping() {
;;
Pattern)
entryLabel="$(_inputbox \
"Enter a new label (friendly name)" "${entryLabel}" \
"Enter Pattern, or pick Amiibo" "${entryLabel}" \
--extra-button --extra-label "Amiibo")"
if [[ "${?}" = "3" ]]; then
entryLabel="$(_amiiboRegex)" || return
_tapto PUT mappings "${id}" "{\"match\": \"regex\"}"
else
_tapto PUT mappings "${id}" "{\"match\": \"exact\"}"
fi
_tapto PUT mappings "${id}" "{\"pattern\": \"${entryPattern}\"}"
;;
Expand Down Expand Up @@ -1869,7 +1871,7 @@ _amiiboRegex() {
unset selectedGameSeries selectedCharacter selectedVariation selectedType selectedAmiiboSeries selectedAmiibo
fi

_yesno "Continue editing?\nCurrent choice:\n${regex}" --no-label "Finish" --cancel-label "Finish" || break
height=8 width="$(( ${#regex} + 6 ))" _yesno "Continue editing?\nCurrent choice:\n${regex}" --no-label "Finish" --cancel-label "Finish" || break
done

echo "${regex}"
Expand Down Expand Up @@ -2048,15 +2050,15 @@ _msgbox() {
# Backtitle is already set
# returns the exit code from dialog which depends on the user answer
_yesno() {
local msg opts
local msg opts height width
msg="${1}"
shift
opts=("${@}")
dialog \
--backtitle "${title}" \
"${opts[@]}" \
--yesno "${msg}" \
22 77 3>&1 1>&2 2>&3 >"$(tty)" <"$(tty)"
"${height:=22}" "${width:=77}" 3>&1 1>&2 2>&3 >"$(tty)" <"$(tty)"
return "${?}"
}

Expand Down

0 comments on commit dc026b3

Please sign in to comment.