NUMBER_PICKER - Ask the user to interactively enter a number via the UI

When to use it

NUMBER_PICKER presents an optimized numerical keyboard whenever a payload needs a number, such as a port or a flexible timeout value.

Syntax

  NUMBER_PICKER [text prompt] [default number]
  

text prompt

Text prompt to show the user. Prompts should be kept short enough to fit on the device display.

default number

Default number for the picker.

The number picker dialog

The number picker dialog

The number picker editor

The number picker editor

Results

NUMBER_PICKER will wait until the user has made a selection, pausing the payload.

NUMBER_PICKER exits with a return code of 0 if the user continues, and non-zero if the user cancels.

NUMBER_PICKER returns the number as the output.

Examples

  __usernum=$(NUMBER_PICKER "Timeout (in seconds)" "5") || exit 0
  
  __usernum=$(NUMBER_PICKER "No default number" "") || exit 0