php-school / cli-menu

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

Auto-toggle CheckableItem #193

Closed jtreminio closed 4 years ago

jtreminio commented 4 years ago

Per this comment it makes sense for a CheckboxItem to auto-toggle itself (either on or off) vs forcing developer to implement this themselves.

CheckableItem::getSelectAction() returns a callable within a callable. The outer callable does the auto-toggling, the inner callable is the user-defined code.

The CheckableItemTest::testGetSelectAction() reflects this stacking.

codecov-io commented 4 years ago

Codecov Report

Merging #193 into master will increase coverage by 0.01%. The diff coverage is 100%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master     #193      +/-   ##
============================================
+ Coverage     93.05%   93.06%   +0.01%     
  Complexity      491      491              
============================================
  Files            27       27              
  Lines          1483     1486       +3     
============================================
+ Hits           1380     1383       +3     
  Misses          103      103
Impacted Files Coverage Δ Complexity Δ
src/MenuItem/CheckableItem.php 87.5% <100%> (+0.83%) 19 <0> (ø) :arrow_down:

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 a0013aa...698e9e3. Read the comment docs.

AydinHassan commented 4 years ago

Nice, was going to suggest this myself!