66use DragonCode \GithubNotifications \Services \GitHub ;
77use DragonCode \GithubNotifications \Services \Output ;
88use Github \ResultPager ;
9+ use Illuminate \Support \Str ;
910use LaravelZero \Framework \Commands \Command ;
1011use Symfony \Component \Console \Exception \InvalidOptionException ;
1112
@@ -36,17 +37,17 @@ public function handle(): void
3637 }
3738 }
3839
39- protected function welcome (array $ repositories , ?array $ exceptRepositories ): void
40+ protected function welcome (array $ includeRepositories , ?array $ exceptRepositories ): void
4041 {
41- if ($ repositories ) {
42- $ this ->bulletList ('You specified the following repository name masks: ' , $ repositories );
42+ if ($ includeRepositories ) {
43+ $ this ->bulletList ('You specified the following repository name masks: ' , $ includeRepositories );
4344 }
4445
4546 if ($ exceptRepositories ) {
4647 $ this ->bulletList ('You specified the following masks to exclude repositories: ' , $ exceptRepositories );
4748 }
4849
49- if (! $ repositories && ! $ exceptRepositories ) {
50+ if (! $ includeRepositories && ! $ exceptRepositories ) {
5051 Output::info ('Mark as read all notifications except open ones ' );
5152 }
5253 }
@@ -95,12 +96,12 @@ protected function gitHub(): GitHub
9596
9697 protected function repositories (): array
9798 {
98- return $ this ->argument ('repository ' );
99+ return $ this ->resolvePattern ( $ this -> argument ('repository ' ) );
99100 }
100101
101- protected function exceptRepositories (): ? array
102+ protected function exceptRepositories (): array
102103 {
103- return array_filter ($ this ->option ('except-repository ' )) ?: null ;
104+ return $ this -> resolvePattern ($ this ->option ('except-repository ' ));
104105 }
105106
106107 protected function exceptIssues (): bool
@@ -127,14 +128,15 @@ protected function bulletList(string $title, array $values): void
127128 {
128129 Output::info ($ title );
129130
130- $ this ->components ->bulletList ($ this -> sort ( $ values) );
131+ $ this ->components ->bulletList ($ values );
131132 }
132133
133- protected function sort ( array $ values ): array
134+ protected function resolvePattern (? array $ values ): array
134135 {
135136 return collect ($ values )
136137 ->filter ()
137138 ->unique ()
139+ ->map (fn (string $ value ) => Str::of ($ value )->trim ()->start ('* ' )->finish ('* ' )->toString ())
138140 ->sort ()
139141 ->all ();
140142 }
0 commit comments