-
Notifications
You must be signed in to change notification settings - Fork 106
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #40 from php-school/feature/disable-items
Add disabled item functionality
- Loading branch information
Showing
10 changed files
with
153 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<?php | ||
|
||
use PhpSchool\CliMenu\CliMenu; | ||
use PhpSchool\CliMenu\CliMenuBuilder; | ||
|
||
require_once(__DIR__ . '/../vendor/autoload.php'); | ||
|
||
$itemCallable = function (CliMenu $menu) { | ||
echo $menu->getSelectedItem()->getText(); | ||
}; | ||
|
||
$menu = (new CliMenuBuilder) | ||
->setTitle('Basic CLI Menu Disabled Items') | ||
->addItem('First Item', $itemCallable) | ||
->addItem('Second Item', $itemCallable, false, true) | ||
->addItem('Third Item', $itemCallable, false, true) | ||
->addSubMenu('Submenu') | ||
->setTitle('Basic CLI Menu Disabled Items > Submenu') | ||
->addItem('You can go in here!', $itemCallable) | ||
->end() | ||
->addSubMenu('Disabled Submenu') | ||
->setTitle('Basic CLI Menu Disabled Items > Disabled Submenu') | ||
->addItem('Nope can\'t see this!', $itemCallable) | ||
->disableMenu() | ||
->end() | ||
->addLineBreak('-') | ||
->build(); | ||
|
||
$menu->open(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters