LScli : add parameters to load class/addon and their CLI commands

This commit is contained in:
Benjamin Renard 2020-04-29 17:13:23 +02:00
parent f52f81c1d4
commit 72b4c27651

View file

@ -73,10 +73,12 @@ class LScli {
echo "$error\n\n"; echo "$error\n\n";
echo "Usage : ".basename($argv[0])." [-h] [-qdC] command\n"; echo "Usage : ".basename($argv[0])." [-h] [-qdC] command\n";
echo " -h Show this message\n"; echo " -h Show this message\n";
echo " -q|--quiet Quiet mode\n"; echo " -q|--quiet Quiet mode\n";
echo " -d|--debug Debug mode\n"; echo " -d|--debug Debug mode\n";
echo " -C|--console Log on console\n"; echo " -C|--console Log on console\n";
echo " -L|--load-class Load specific class to permit access to its CLI commands\n";
echo " -A|--load-addons Load specific addon to permit access to its CLI commands\n";
echo " command Command to run\n"; echo " command Command to run\n";
echo "\n"; echo "\n";
echo "Available commands :\n"; echo "Available commands :\n";
@ -133,6 +135,20 @@ class LScli {
case '--console': case '--console':
LSlog :: logOnConsole(); LSlog :: logOnConsole();
break; break;
case '-L':
case '--load-class':
$i++;
$class = $argv[$i];
if(!LSsession :: loadLSclass($class))
self :: usage("Fail to load class '$class'.");
break;
case '-A':
case '--load-addon':
$i++;
$addon = $argv[$i];
if(!LSsession :: loadLSaddon($addon))
self :: usage("Fail to load addon '$addon'.");
break;
default: default:
if ($command) if ($command)
$command_args[] = $argv[$i]; $command_args[] = $argv[$i];