Skip to content

Latest commit

 

History

History
28 lines (23 loc) · 1.04 KB

File metadata and controls

28 lines (23 loc) · 1.04 KB

submenu

Parse a list_options message and present commands as an interactive menu.

About

Displays available commands from a list_options message using whiptail, dialog, or terminal input. Returns the selected command for further processing.

Usage

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.conf and ./src/core/interface/submenu.sh