Esempio n. 1
0
 /**
  * requires the classes to be tested
  */
 public function setUp()
 {
     require_once 'Jm/Autoloader.php';
     $this->console = Jm_Console::singleton();
     $this->console->stdin()->enforceIsatty(TRUE);
     $this->console->stdout()->enforceIsatty(TRUE);
     $this->console->stderr()->enforceIsatty(TRUE);
 }
Esempio n. 2
0
/**
 *
 */
function progressbar($now, $total, $w = 35)
{
    $console = Jm_Console::singleton();
    $console->write('[', 'white,light');
    $n = floor($now * $w / $total);
    $console->write(str_repeat('+', $n), 'green,light');
    if ($n < $w) {
        $console->write(']', 'green,light');
        $console->write(str_repeat('-', $w - $n - 1), 'red,light');
    }
    $console->write(']', 'white,light');
}
Esempio n. 3
0
<?php

require_once 'Jm/Autoloader.php';
Jm_Autoloader::singleton()->prependPath('lib/php');
$console = Jm_Console::singleton();
$console->write('hello', 'black,bg:yellow');
$console->write(' ');
$console->writeln('world', 'black,bg:red');
Esempio n. 4
0
 /**
  * Returns a reference to the console. The returned object is a singleton.
  *
  * @return Jm_Console
  */
 public static function singleton()
 {
     if (!self::$singletonInstance) {
         $class = get_called_class();
         self::$singletonInstance = new $class();
     }
     return self::$singletonInstance;
 }