<?php use Anslo\Console\Cli; Cli::command("say hello to {{name}}", function ($args, $flags) { if ($flags->loud == true) { return "HELLO, {$args->name}!!!"; } return "hello, {$args->name}."; });
<?php use Anslo\Console\Cli; use Anslo\Console\Flags; use Anslo\Console\Arguments; use Anslo\Console\Ask; use Fs; Cli::command("ng", function (Ask $ask, Fs $fs) { $ngAppName = $ask->question("What would you like to name your angular application?"); if (file_exists(dirname(__DIR__) . "/ng/" . $ngAppName)) { throw new Exception("Angular app already exists."); } });
} }); }, file_get_contents(dirname(__FILE__) . "/console/descriptions/ng.html")); Cli::command("build ng", function () { $output = shell_exec('gulp ng'); return $output; }, file_get_contents(dirname(__FILE__) . "/console/descriptions/ng.html")); Cli::command("build mjml", function () { $output = shell_exec('gulp ng'); return $output; }, file_get_contents(dirname(__FILE__) . "/console/descriptions/ng.html")); Cli::command("help", function ($args) { $cmds = ""; $commandList = Registry::settings()->commands; sort($commandList); foreach ($commandList as $command) { if ($command["comments"] !== "") { $cmds .= "------------------------\n"; $cmds .= " |" . $command["origin"] . "\n------------------------\n" . $command["comments"] . "\n\n\n"; } else { $cmds .= "------------------------\n"; $cmds .= " |" . $command["origin"] . "\n------------------------\n NA\n\n\n"; } } return strtr(file_get_contents("./system/console/help"), ["{{commands}}" => $cmds, "{{date}}" => date("Y")]); }); Cli::uncaught(function () { return "Sorry! Could not find command. Here is a list of all the commands.\n\n\n" . Cli::run("help"); }); Cli::findArgv();