File tree 4 files changed +12
-15
lines changed
4 files changed +12
-15
lines changed Original file line number Diff line number Diff line change @@ -24,13 +24,13 @@ filters:
24
24
rules :
25
25
- name : Refactor
26
26
start_withs : [refactor, break]
27
- contains : ['refactor:']
27
+ contains : ['refactor:', 'break:' ]
28
28
- name : Fixed
29
29
start_withs : [fix]
30
30
contains : ['fix:']
31
31
- name : Feature
32
32
start_withs : [feat, new]
33
- contains : [feature ]
33
+ contains : ['feat:', 'new:' ]
34
34
- 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 31
31
32
32
// or use property
33
33
// $cmd->arguments = [...];
34
+ // $cmd->getFlags()->setExample($example);
34
35
})
35
36
->withArguments ([
36
37
'arg1 ' => 'this is arg1, is string '
Original file line number Diff line number Diff line change 21
21
class CliCmd
22
22
{
23
23
use AutoConfigTrait {
24
- __construct as supper;
24
+ AutoConfigTrait:: __construct as supper;
25
25
}
26
26
27
27
public string $ name = '' ;
Original file line number Diff line number Diff line change 27
27
use function sprintf ;
28
28
use function str_split ;
29
29
use function strlen ;
30
+ use function strpos ;
30
31
use function substr ;
31
32
32
33
/**
@@ -216,16 +217,11 @@ protected function parseOneOption(): array
216
217
217
218
$ value = '' ;
218
219
$ 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 );
229
225
}
230
226
231
227
$ rName = $ this ->resolveAlias ($ name );
You can’t perform that action at this time.
0 commit comments