示例#1
0
 /**
  * A default index method that all CLI Controllers can share. Will
  * list all of the methods and their short descriptions, if available.
  */
 public function index()
 {
     CLI::new_line();
     CLI::write(lang('cli.available_commands'));
     $this->sayDescriptions($this->descriptions);
     CLI::new_line();
 }
示例#2
0
 /**
  * Overrides CLIController's version to support searching our
  * collections for the help description.
  *
  * @param null $method
  */
 public function longDescribeMethod($method = null)
 {
     $collections = config_item('forge.collections');
     if (!is_array($collections) || !count($collections)) {
         return CLI::error('No generator collections found.');
     }
     // We loop through each collection scanning
     // for any generator folders that have a
     // 'forge.php' file. For each one found
     // we build out another section in our help commands
     foreach ($collections as $alias => $path) {
         $path = rtrim($path, '/ ') . '/';
         $folders = scandir($path);
         if (!($i = array_search(ucfirst($method), $folders))) {
             continue;
         }
         $dir = $path . $folders[$i] . '/';
         if (!is_file($dir . '/forge.php')) {
             CLI::error("The {$method} command does not have any cli help available.");
         }
         include $dir . '/forge.php';
         // Don't have valid arrays to work with? Move along...
         if (!isset($long_description)) {
             log_message('debug', '[Forge] Invalid forge.php file at: ' . $dir . '/forge.php');
             continue;
         }
         if (empty($long_description)) {
             return CLI::error("The {$method} command does not have an cli help available.");
         }
         CLI::new_line();
         CLI::write(CLI::color(ucfirst($method) . ' Help', 'yellow'));
         return CLI::write(CLI::wrap($long_description, CLI::getWidth()));
     }
     // Still here?
     CLI::error("No help found for command: {$method}");
 }
示例#3
0
 /**
  * Outputs the contents of the file in the template's source path.
  */
 public function readme($file = 'readme.txt')
 {
     $name = str_replace('Generator', '', get_class($this));
     $path = $this->locateGenerator($name);
     if (!file_exists($path . $file)) {
         CLI::error(sprintf(lang('forge.cant_find_readme'), $file));
     }
     $contents = file_get_contents($path . $file);
     CLI::new_line(2);
     CLI::write(CLI::wrap($contents), 'green');
     CLI::new_line();
 }
示例#4
0
<?php

defined('BASEPATH') or exit('No direct script access allowed');
?>

<?php 
echo \Myth\CLI::error("\n\tA PHP Error was encountered");
?>

<?php 
echo \Myth\CLI::write("\tSeverity: {$severity}");
echo \Myth\CLI::write("\tMessage: {$message}");
echo \Myth\CLI::write("\tFilename: {$filepath}");
echo \Myth\CLI::write("\tLine Number: {$line}");
?>

<?php 
if (defined('SHOW_DEBUG_BACKTRACE') && SHOW_DEBUG_BACKTRACE === TRUE) {
    echo \Myth\CLI::write("\n\tBacktrace");
    foreach (debug_backtrace() as $error) {
        if (isset($error['file']) && strpos($error['file'], realpath(BASEPATH)) !== 0) {
            echo \Myth\CLI::write("\t\t- {$error['function']}() - Line {$error['line']} in {$error['file']}");
        }
    }
}
echo \Myth\CLI::new_line();