Skip to content

Make defaultControlMappings static #175

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

Closed
wants to merge 1 commit into from
Closed

Conversation

Lynesth
Copy link
Collaborator

@Lynesth Lynesth commented Apr 2, 2019

I guess that's more what we expect from the whole thing now that we can modify it.
Made those 2 new functions static too because I think it makes more sense.

Snippet:

CliMenu::disableDefaultControlMappings()

$menu = (new CliMenuBuilder) // Will be disabled for this menu
    ->setTitle('Main menu')
    ->addSubMenu('Options', function (CliMenuBuilder $b) { // Will also be disabled for submenus
        $b->setTitle('Submenu')
            ->addStaticItem('Some text')
            ->addLineBreak('-');
    })
    ->build();

@AydinHassan
Copy link
Member

I'm not really a fan of this, it's a new convention. The way we do this for other stuff like the styles is use the builder. If this were to be set on the builder then it could take care of making sure it is applied to submenus as well.

@codecov-io
Copy link

codecov-io commented Apr 2, 2019

Codecov Report

Merging #175 into master will not change coverage.
The diff coverage is 33.33%.

Impacted file tree graph

@@            Coverage Diff            @@
##             master     #175   +/-   ##
=========================================
  Coverage     97.26%   97.26%           
  Complexity      423      423           
=========================================
  Files            25       25           
  Lines          1317     1317           
=========================================
  Hits           1281     1281           
  Misses           36       36
Impacted Files Coverage Δ Complexity Δ
src/CliMenu.php 96.88% <33.33%> (ø) 98 <2> (ø) ⬇️

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 83fbce5...cf05f83. Read the comment docs.

@Lynesth
Copy link
Collaborator Author

Lynesth commented Apr 2, 2019

True.
Working on many project I tend to forget how we're supposed to do things sometimes.
Will redo this properly.

@Lynesth Lynesth closed this Apr 2, 2019
@AydinHassan
Copy link
Member

Thanks for the effort though, it is appreciated :)

@AydinHassan AydinHassan deleted the Lynesth-patch-1 branch February 15, 2020 19:01
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