forked from php-school/cli-menu
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathremove-defaults.php
More file actions
34 lines (24 loc) · 798 Bytes
/
Copy pathremove-defaults.php
File metadata and controls
34 lines (24 loc) · 798 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
<?php
declare(strict_types=1);
use PhpSchool\CliMenu\CliMenu;
use PhpSchool\CliMenu\Builder\CliMenuBuilder;
require_once(__DIR__ . '/../vendor/autoload.php');
$itemCallable = function (CliMenu $menu) {
echo $menu->getSelectedItem()->getText();
};
$menu = (new CliMenuBuilder)
->setTitle('Basic CLI Menu Remove Defaults')
->addItem('First Item', $itemCallable)
->addItem('Second Item', $itemCallable)
->addItem('Third Item', $itemCallable)
->disableDefaultItems()
->addItem('CUSTOM CLOSE', function (CliMenu $menu) {
$menu->close();
})
->build();
$menu->open();
echo 'Execution will just continue after calling $menu->close()';
sleep(2);
echo "\n\nYou can pretty much do anything you want then, maybe even re-open it?";
sleep(2);
$menu->open();