class Menu
A generic menu class for console based interactions with user. Inspired by https://github.com/bryandh/genericmenu, but adjusted to our the particular needs of this project.
Menu(renderer: Renderer)
A generic menu class for console based interactions with user. Inspired by https://github.com/bryandh/genericmenu, but adjusted to our the particular needs of this project. |
fun addItem(key: String, label: String, action: () -> Unit, isTerminating: Boolean = false): Menu
Adds a menu item to the list of the menu items. The order in which the items are added matters. If the exit option is set (@see setExitOption then it will be displayed always as the last element in the menu. |
|
fun setExitOption(key: String, label: String): Menu
Sets the exit option with given key and label. |
|
fun showMenu(): Unit
Shows the menu built out of the given menu items and (if present) exit option. |
|
fun withExceptionHandler(handler: (exception: Exception) -> Unit): Menu
Assigns the exception handler for this menu. The exception handler is invoked every time any of the menu item selection handler function throws an exception. |