File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -81,7 +81,18 @@ public function help()
8181 require_once (OB_LOCAL . '/core/cli/ ' . $ cliPath );
8282
8383 $ cliClass = new $ cliClassName ();
84- $ rows = [...$ rows , ...$ cliClass ->help ()];
84+ $ help = $ cliClass ->help ();
85+
86+ if (is_array ($ help )) {
87+ foreach ($ help as &$ helpItem ) {
88+ $ helpItem [0 ] = $ cliCommand . ' ' . $ helpItem [0 ];
89+ }
90+ $ rows = [...$ rows , ...$ help ];
91+ }
92+
93+ if (is_string ($ help )) {
94+ $ rows = [...$ rows , [$ cliCommand , $ help ]];
95+ }
8596 }
8697
8798 echo Helpers::table (spacing: 5 , rows: $ rows );
Original file line number Diff line number Diff line change @@ -15,7 +15,7 @@ abstract class CLI
1515 protected $ db ;
1616 protected $ models ;
1717
18- protected array $ help ;
18+ protected array | string $ help ;
1919
2020 final public function __construct ()
2121 {
@@ -27,7 +27,7 @@ final public function __construct()
2727 }
2828 }
2929
30- final public function help (): array
30+ final public function help (): array | string
3131 {
3232 return $ this ->help ;
3333 }
Original file line number Diff line number Diff line change 66
77class CheckInstall extends CLI
88{
9- protected array $ help = [
10- ['check install ' , 'check installation for errors ' ]
11- ];
9+ protected array |string $ help = 'check installation for errors ' ;
1210
1311 public function run (array $ args ): bool
1412 {
Original file line number Diff line number Diff line change 66
77class CheckMedia extends CLI
88{
9- protected array $ help = [
10- ['check media ' , 'check media for errors ' ],
11- ];
9+ protected array |string $ help = 'check media for errors ' ;
1210
1311 public function run (array $ args ): bool
1412 {
Original file line number Diff line number Diff line change 77class Cron extends CLI
88{
99 private string $ obCronLog ;
10- protected array $ help = [
11- ['cron run ' , 'run scheduled tasks once ' ],
12- ['cron run <module> <task> [now] ' , 'run scheduled task for module ' ],
13- ['cron monitor ' , 'monitor and run cron tasks as needed ' ],
10+ protected array | string $ help = [
11+ ['run ' , 'run scheduled tasks once ' ],
12+ ['run <module> <task> [now] ' , 'run scheduled task for module ' ],
13+ ['monitor ' , 'monitor and run cron tasks as needed ' ],
1414 ];
1515
1616 public function run (array $ args ): bool
Original file line number Diff line number Diff line change 66
77class Modules extends CLI
88{
9- protected array $ help = [
10- ['modules list ' , 'list all modules and their status ' ],
11- ['modules install <name> ' , 'install module ' ],
12- ['modules uninstall <name> ' , 'uninstall module ' ],
13- ['modules purge <name> ' , 'uninstall module and delete all data ' ],
9+ protected array | string $ help = [
10+ ['list ' , 'list all modules and their status ' ],
11+ ['install <name> ' , 'install module ' ],
12+ ['uninstall <name> ' , 'uninstall module ' ],
13+ ['purge <name> ' , 'uninstall module and delete all data ' ],
1414 ];
1515
1616 public function run (array $ args ): bool
Original file line number Diff line number Diff line change 66
77class Passwd extends CLI
88{
9- protected array $ help = [
10- ['passwd <username> ' , 'change password for user ' ],
9+ protected array | string $ help = [
10+ ['<username> ' , 'change password for user ' ],
1111 ];
1212
1313 public function run (array $ args ): bool
Original file line number Diff line number Diff line change 66
77class UpdatesList extends CLI
88{
9- protected array $ help = [
10- ['updates list all ' , 'list all available updates ' ],
11- ['updates list core ' , 'list core ob updates ' ],
12- ['updates list module <name> ' , 'list updates for specified module ' ],
9+ protected array | string $ help = [
10+ ['all ' , 'list all available updates ' ],
11+ ['core ' , 'list core ob updates ' ],
12+ ['module <name> ' , 'list updates for specified module ' ],
1313 ];
1414
1515 public function run (array $ args ): bool
Original file line number Diff line number Diff line change 66
77class UpdatesRun extends CLI
88{
9- protected array $ help = [
10- ['updates run all ' , 'run all available updates ' ],
11- ['updates run core ' , 'run core ob updates ' ],
12- ['updates run module <name> ' , 'run updates for specified module ' ],
9+ protected array | string $ help = [
10+ ['all ' , 'run all available updates ' ],
11+ ['core ' , 'run core ob updates ' ],
12+ ['module <name> ' , 'run updates for specified module ' ],
1313 ];
1414
1515 public function run (array $ args ): bool
You can’t perform that action at this time.
0 commit comments