Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds custom control mapping #87

Merged
merged 1 commit into from
May 1, 2018
Merged

Conversation

Lynesth
Copy link
Collaborator

@Lynesth Lynesth commented May 1, 2018

Allow mapping custom keys to callables.
It works per menu so you can set custom controls for shortcuts for example.

$myCallback = function(CliMenu $menu) {
    // Do something
}

$menu = (new CliMenuBuilder)
    ->addItem('List of [C]lients', $myCallback)
    ->build();

// Now, pressing Uppercase C (it's case sensitive) will call $myCallback
$menu->addCustomMapping("C", $myCallback);

$menu->open();

Allow mapping custom keys to callables.
@codecov-io
Copy link

Codecov Report

Merging #87 into master will decrease coverage by 1.22%.
The diff coverage is 8.33%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master      #87      +/-   ##
============================================
- Coverage     96.47%   95.24%   -1.23%     
- Complexity      278      284       +6     
============================================
  Files            22       22              
  Lines           879      884       +5     
============================================
- Hits            848      842       -6     
- Misses           31       42      +11
Impacted Files Coverage Δ Complexity Δ
src/CliMenu.php 84.53% <8.33%> (-5.82%) 66 <5> (+6)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 4c883fb...b4968db. Read the comment docs.

@AydinHassan
Copy link
Member

Nice feature and example - I like.

@AydinHassan AydinHassan merged commit 82796c1 into php-school:master May 1, 2018
@AydinHassan AydinHassan added this to the 3.0 milestone May 7, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants