menu/menu_io library
A numbered console menu for a dart run script: mainMenuConsole then
the declarations of package:dev_build/menu/menu.dart.
import 'package:dev_build/menu/menu_io.dart';
void main(List<String> arguments) {
mainMenuConsole(arguments, () {
item('hello', () => write('Hello'));
});
}
Extra command line arguments run as typed lines (0 . runs item 0 then
exits), a prompt takes the next one first.
Functions
-
command(
dynamic body(String command)) → void - Declare function called when we enter a non handled command
-
devWrite(
Object? message) → void - Write a line on the presenter, deprecated to make it a temp debug call
-
enter(
dynamic body()) → void - Declare function called when we enter a menu
-
enterItem(
dynamic body()) → void - Declare function called when we enter a menu
-
initMenuConsole(
List< String> arguments) → void - Initialize the test menu console.
-
item(
String name, dynamic body(), {String? cmd, bool? solo}) → void - Declare a menu item
-
leave(
dynamic body()) → void - Declare function called when we leave a menu
-
leaveItem(
dynamic body()) → void - Declare function called when we leave a menu
-
mainMenuConsole(
List< String> arguments, void declare()) → void - Main menu declaration
- Declare a menu
- run the last declared menu/items
-
popMenu(
) → Future< bool> - Pop the current menu.
-
prompt(
[Object? message]) → Future< String> - Prompt for a string.
-
showMenu(
void declare()) → Future< void> - Show a new menu.
-
solo_item(
String name, dynamic body(), {String? cmd, bool? solo}) → void -
Unless
solois set to false, will run as solo. -
Unless
solois set to false, will run as solo. -
write(
Object? message) → void - Write a line on the presenter
-
writeln(
Object? message) → void - Write a line on the presenter