X-Git-Url: https://feistymeow.org/gitweb/?a=blobdiff_plain;f=production%2Fexample_apps%2Fzippy_maps%2Fsrc%2FShell%2FConsoleShell.php;fp=production%2Fexample_apps%2Fzippy_maps%2Fsrc%2FShell%2FConsoleShell.php;h=c84bd97acd0f8f1357e9d83cde7ccc30b398b0ae;hb=34d1cb2e8687b826357db1d3821bf9e05cf6f13d;hp=0000000000000000000000000000000000000000;hpb=21f30bb859e6c15393e23ac0e5ef417b82f628a5;p=feisty_meow.git diff --git a/production/example_apps/zippy_maps/src/Shell/ConsoleShell.php b/production/example_apps/zippy_maps/src/Shell/ConsoleShell.php new file mode 100644 index 00000000..c84bd97a --- /dev/null +++ b/production/example_apps/zippy_maps/src/Shell/ConsoleShell.php @@ -0,0 +1,81 @@ +err('Unable to load Psy\Shell.'); + $this->err(''); + $this->err('Make sure you have installed psysh as a dependency,'); + $this->err('and that Psy\Shell is registered in your autoloader.'); + $this->err(''); + $this->err('If you are using composer run'); + $this->err(''); + $this->err('$ php composer.phar require --dev psy/psysh'); + $this->err(''); + + return self::CODE_ERROR; + } + + $this->out("You can exit with `CTRL-C` or `exit`"); + $this->out(''); + + Log::drop('debug'); + Log::drop('error'); + $this->_io->setLoggers(false); + restore_error_handler(); + restore_exception_handler(); + + $psy = new PsyShell(); + $psy->run(); + } + + /** + * Display help for this console. + * + * @return \Cake\Console\ConsoleOptionParser + */ + public function getOptionParser() + { + $parser = new ConsoleOptionParser('console'); + $parser->setDescription( + 'This shell provides a REPL that you can use to interact ' . + 'with your application in an interactive fashion. You can use ' . + 'it to run adhoc queries with your models, or experiment ' . + 'and explore the features of CakePHP and your application.' . + "\n\n" . + 'You will need to have psysh installed for this Shell to work.' + ); + + return $parser; + } +}