File tree Expand file tree Collapse file tree 4 files changed +12
-15
lines changed
Expand file tree Collapse file tree 4 files changed +12
-15
lines changed Original file line number Diff line number Diff line change @@ -24,13 +24,13 @@ filters:
2424rules :
2525 - name : Refactor
2626 start_withs : [refactor, break]
27- contains : ['refactor:']
27+ contains : ['refactor:', 'break:' ]
2828 - name : Fixed
2929 start_withs : [fix]
3030 contains : ['fix:']
3131 - name : Feature
3232 start_withs : [feat, new]
33- contains : [feature ]
33+ contains : ['feat:', 'new:' ]
3434 - name : Update
35- start_withs : [update, 'up:' ]
36- contains : []
35+ start_withs : [up ]
36+ contains : ['update:', 'up:' ]
Original file line number Diff line number Diff line change 3131
3232 // or use property
3333 // $cmd->arguments = [...];
34+ // $cmd->getFlags()->setExample($example);
3435})
3536 ->withArguments ([
3637 'arg1 ' => 'this is arg1, is string '
Original file line number Diff line number Diff line change 2121class CliCmd
2222{
2323 use AutoConfigTrait {
24- __construct as supper;
24+ AutoConfigTrait:: __construct as supper;
2525 }
2626
2727 public string $ name = '' ;
Original file line number Diff line number Diff line change 2727use function sprintf ;
2828use function str_split ;
2929use function strlen ;
30+ use function strpos ;
3031use function substr ;
3132
3233/**
@@ -216,16 +217,11 @@ protected function parseOneOption(): array
216217
217218 $ value = '' ;
218219 $ hasVal = false ;
219- for ($ i = 0 ; $ i < $ optLen ; $ i ++) {
220- if ($ name [$ i ] === '= ' ) {
221- $ hasVal = true ;
222- $ name = substr ($ name , 0 , $ i );
223-
224- // fix: `--name=` no value string.
225- if ($ i + 1 < $ optLen ) {
226- $ value = substr ($ name , $ i + 1 );
227- }
228- }
220+ $ eqPos = strpos ($ name , '= ' );
221+ if ($ eqPos > 0 ) {
222+ $ hasVal = true ;
223+ $ value = substr ($ name , $ eqPos + 1 );
224+ $ name = substr ($ name , 0 , $ eqPos );
229225 }
230226
231227 $ rName = $ this ->resolveAlias ($ name );
You can’t perform that action at this time.
0 commit comments