Parse a list_options message and present commands as an interactive menu.
Displays available commands from a list_options message using whiptail, dialog, or terminal input. Returns the selected command for further processing.
Usage: submenu [HELP_MESSAGE]
- Accepts a string argument or reads from stdin.
- Uses whiptail (preferred), dialog, or plain read (fallback).
- Returns the selected command string on success.
Example:
help_msg="Usage: configng_v2.sh [options]
adjust_motd - Adjust welcome screen (motd)
cockpit - Web-based admin interface for managing Linux servers.
package - Helpers for bulk package operations."
choice=$(submenu "$help_msg")
[[ -n "$choice" ]] && echo "You chose: $choice"
Notes:
- Intended for use in configng-v2 modules and scripts.
- Only parses lines matching '<command> - <description>'.
- Set DIALOG=dialog to prefer dialog, otherwise whiptail is default.- Autogenerated from
./src/core/interface/submenu.confand./src/core/interface/submenu.sh