* @license licenses/mind3rd.license */ use Symfony\Component\Console\Input\InputArgument, Symfony\Component\Console\Input\InputOption, Symfony\Component\Console; /** * This class represents the program auth, receiving the user and * may also receive the password. It will start your session * allowing you to run the restricted programs * * @author Felipe Nascimento de Moura */ class Generate extends MindCommand implements program { public $lobe; public $param; public $detail; public $optional; public $extra; public function __construct() { $dir= \theos\Gosh::getLobesDir(); $d = dir($dir); $options= Array(); $avOpts= Array(); while (false !== ($entry = $d->read())) { if(is_dir($dir.$entry) && substr($entry, 0, 1) != '.') { $options[]= " >".$entry."\n"; $avOpts[]= $entry; } } $d->close(); $help= <<setCommandName('generate') ->setDescription('Generates different outputs') ->setRestrict(true) ->setAction('action') ->setHelp($help); $this->addRequiredArgument('lobe', 'Lobe to be used', $avOpts); $this->addOptionalArgument('param', 'A param for that command'); $this->addOptionalArgument('detail', 'A detail for that command'); $this->addOptionalArgument('optional', 'An optional argument'); $this->addOptionalArgument('extra', 'Extra data to be passed'); $this->init(); } public function action() { if(!isset($_SESSION['currentProject'])) { Mind::write('currentProjectRequired'); Mind::write('currentProjectRequiredTip'); return false; } Mind::write('thinking'); if($exec= Mind::$gosh->generate(Array( $this->lobe, $this->param, $this->detail, $this->optional, $this->extra ))) return false; return $this; } }