nyxnor / onionjuggler

Manage your Onion Services via CLI or TUI on Unix-like operating system with a POSIX compliant shell.
MIT License
34 stars 2 forks source link

Checklist could be different than 2 entries #3

Closed radio24 closed 2 years ago

radio24 commented 2 years ago

https://github.com/nyxnor/onionservice/blob/d429606e546b65321ce8b7191cd23702f8871dbb/onionservice-tui#L70

Issue It seems (I use whiptail instead of dialog) that the "2" representing two entries is hardcoded in this line of code. However, someone may have only one or several entries.

Describe the solution you'd like For the above reasons, I propose to replace "2" with "$i". To be sure that the list is not getting too long and is fitting to a little LCD display, the entire code could look like that:

if [ $i -gt 11 ]; then i=11; fi
CHOICE_SERVICE="$(dialog --clear --backtitle "${BACKTITLE}" --title "${TITLE}" --"${DIALOG_TYPE}" "${MENU}" \
"$((i+8))" 80 ${i} ${SERVICE_LIST} 2>&1 >/dev/tty)"

Additional remarks I didn't submit a pull request yet because I don't use dialog, and I'm not entirely sure it reacts like whiptail.

nyxnor commented 2 years ago

I am loving this bug issue template, really helps

On dialog, one or more services works fine

1 service:

image

3 services:

image

LCD display

Yes, max will be pinned, so this change would be accepted, if possible to consider also the AUTH_* and any other relevant option to pin/fix lines regarding clients names (why 11?).

    [ "${i}" -gt 11 ] && i=11
    # shellcheck disable=SC2086
    CHOICE_SERVICE="$(dialog --clear --backtitle "${BACKTITLE}" --title "${TITLE}" --"${DIALOG_TYPE}" "${MENU}" \
    "$((i+8))" 80 ${i} ${SERVICE_LIST} 2>&1 >/dev/tty)"

image

radio24 commented 2 years ago

11 because this is the maximum number I can squeeze into my PiTFT Plus 480x320 3.5".