Пример #1
0
 public function printOptions()
 {
     if (count($this->descriptionTable) > 0) {
         pantr::out()->nl()->writeln('Options:', 'BOLD');
         foreach ($this->descriptionTable as $long => $desc) {
             // check if there is a short version
             if (isset($this->requestAliasTable[$long])) {
                 $short = $this->requestAliasTable[$long];
                 pantr::writeOption($short, $long, $desc);
             } else {
                 pantr::writeOption($long, $desc);
             }
         }
     }
 }
Пример #2
0
 public function upload($files, $in)
 {
     $this->progressBar = new \Pagosoft\Console\ProgressBar(pantr::out(), count($files));
     $tree = $this->createTree($files);
     if (is_null($in)) {
         $stack = array();
     } else {
         $stack = array($in);
     }
     $this->progressBar->paint();
     $this->uploadTree($tree, $stack);
     $this->progressBar->erase();
 }
Пример #3
0
 public function tearDown()
 {
     pantr::out()->disableColorizedOutput(false);
 }
Пример #4
0
            $task = $tasks[$taskName];
            if ($task->getName() == 'help') {
                $task->desc('Display detailed information for a task');
            }
            $task->printHelp();
        }
    } else {
        // show summary of all tasks
        pantr::writeln('Usage:', pantr::SECTION)->write('pantr [options]')->write(' <task> ', pantr::PARAMETER)->writeln('[args]');
        Application::printOptions();
        pantr::out()->nl()->writeln('Available tasks:', pantr::SECTION);
        $showGlobalTasks = isset($req['global-tasks']);
        $tasks = pantr::getDefinedTasks();
        $names = array_keys($tasks);
        sort($names);
        foreach ($names as $key) {
            $task = $tasks[$key];
            $taskName = $task->getName();
            $isGlobalTask = $task->isGlobal();
            $showTask = $task->isHidden() == false && $showGlobalTasks == $isGlobalTask;
            if ($showTask) {
                if ($task->getName() != $key) {
                    pantr::writeAction($key, 'Alias for [' . $task->getName() . '|INFO]');
                } else {
                    pantr::writeAction($key, $task->getDescription());
                }
            }
        }
        pantr::out()->nl()->writeln('Help', pantr::SECTION)->write('See ')->write('pantr help ', pantr::COMMENT)->write('<task> ', pantr::PARAMETER)->writeln(' for help with a specific task.');
    }
});