-
Notifications
You must be signed in to change notification settings - Fork 108
Expand file tree
/
Copy pathuseful-separation.php
More file actions
37 lines (32 loc) · 1.05 KB
/
useful-separation.php
File metadata and controls
37 lines (32 loc) · 1.05 KB
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
35
36
37
<?php
declare(strict_types=1);
use PhpSchool\CliMenu\CliMenu;
use PhpSchool\CliMenu\Builder\CliMenuBuilder;
use PhpSchool\CliMenu\MenuItem\MenuItem;
require_once(__DIR__ . '/../vendor/autoload.php');
$itemCallable = function (CliMenu $menu) {
echo $menu->getSelectedItem()->getText();
};
$menu = (new CliMenuBuilder)
->setTitle('Useful CLI Menu Separation')
->addLineBreak()
->addStaticItem('Section 1')
->addStaticItem('---------')
->addItem('First Item', $itemCallable)
->addItem('Second Item', $itemCallable)
->addItem('Third Item', $itemCallable)
->addLineBreak()
->addStaticItem('Section 2')
->addStaticItem('---------')
->addItem('Fourth Item', $itemCallable)
->addItem('Fifth Item', $itemCallable)
->addItem('Sixth Item', $itemCallable)
->addLineBreak()
->addStaticItem('Section 3')
->addStaticItem('---------')
->addItem('Seventh Item', $itemCallable)
->addItem('Eighth Item', $itemCallable)
->addItem('Ninth Item', $itemCallable)
->addLineBreak()
->build();
$menu->open();