php-school / cli-menu

🖥 Build beautiful PHP CLI menus. Simple yet Powerful. Expressive DSL.
http://www.phpschool.io
MIT License
1.94k stars 107 forks source link

Adds the ability to add multiple checkbox and radio items #241

Closed octoper closed 3 years ago

octoper commented 3 years ago

This PR adds the ability to add multipe checkbox and radio items at once.

Examples:

Checkbox

<?php

use PhpSchool\CliMenu\Builder\CliMenuBuilder;
use PhpSchool\CliMenu\CliMenu;

$callable = function (CliMenu $menu) {
    echo 'I am alive!';
};

$menu = (new CliMenuBuilder)
    ->addCheckboxItems([
        ['Item 1', $callable],
        ['Item 2', $callable],
        ['Item 3', $callable],
    ])
    ->build();

Radio

<?php

use PhpSchool\CliMenu\Builder\CliMenuBuilder;
use PhpSchool\CliMenu\CliMenu;

$callable = function (CliMenu $menu) {
    echo 'I am alive!';
};

$menu = (new CliMenuBuilder)
    ->addRadioItems([
        ['Item 1', $callable],
        ['Item 2', $callable],
        ['Item 3', $callable],
    ])
    ->build();
AydinHassan commented 3 years ago

@octoper thanks for the perfect pr, tests, docs, examples. Will merge when travis runs, probably next week at this rate (it's very slow) 😭

octoper commented 3 years ago

Thinking about making a PR to move from TravisCI to GitHub actions if it's good with you 😅

AydinHassan commented 3 years ago

I did try before but there were some problems with the tty stuff we do. It is definitely welcome if you would like to have a crack!

octoper commented 3 years ago

cc @AydinHassan hopefully TravisCI passed 😅

AydinHassan commented 3 years ago

Thanks @octoper !

octoper commented 3 years ago

Do you need both https://codecov.io and https://scrutinizer-ci.com ? (sorry that I'm mention that here but I don't know how to contact you) cc @AydinHassan

mikeymike commented 3 years ago

@octoper feel free to join us on Slack https://phpschool.herokuapp.com/

AydinHassan commented 3 years ago

We can drop scrutinizer, we have done for the other repos 🙂