Prints help output

@return int Status code
322951
final protected function printHelp()
    {
        $script = $this->parser->getScriptName();

        $this->printUsage($script);

        $this->printDescription();

        /** @var $option Option */
        foreach ($this->options as $option) {
            echo " " . $option . "\n";
        }

        echo "\n";

        $this->notify("output");

        $this->notify("shutdown");

        return 0;
    }
326088
public function showHelp()
    {
        $io     = $this->io();
        $helper = new OutputHelper($io->writer());

        $io->bold("Command {$this->_name}, version {$this->_version}", true)->eol();
        $io->comment($this->_desc, true)->eol();
        $io->bold('Usage: ')->yellow("{$this->_name} [OPTIONS...] [ARGUMENTS...]", true);

        $helper
            ->showArgumentsHelp($this->allArguments())
            ->showOptionsHelp($this->allOptions(), '', 'Legend: <required> [optional] variadic...');

        if ($this->_usage) {
            $io->eol();
            $io->boldGreen('Usage Examples:', true)->colors($this->_usage)->eol();
        }

        return $this->emit('_exit', 0);
    }
1089273
public function renderHelp()
    {
        $this->renderHeader();

        echo Line::begin('Usage:', Line::YELLOW)->nl();
        echo Line::begin()
            ->indent(2)
            ->text($this->getUsage())
            ->nl(2);

        // Options
        echo Line::begin('Options:', Line::YELLOW)->nl();
        echo Line::begin()
            ->indent(2)
            ->text('--help', Line::MAGENTA)
            ->to(21)
            ->text('-h', Line::MAGENTA)
            ->text('Display this help message.')
            ->nl(1);

        $attributes = $this->attributeNames();
        $help = $this->attributeHelp();

        sort($attributes);

        foreach ($attributes as $name) {
            echo Line::begin()
                ->indent(2)
                ->text("--$name", Line::MAGENTA)
                ->to(24)
                ->text(isset($help[$name]) ? $help[$name] : '')
                ->nl();
        }

        exit(0);
    }
1081306
public function helpCommand()
    {
        $args = $this->cliHandler->getArgs();
        if (isset($args[2]) && $args[2] !== 'help' && $args[2][0] !== '-') {
            $actionName = $args[2];
        } elseif (isset($args[3]) && $args[2] === 'help' && $args[3][0] !== '-') {
            $actionName = $args[3];
        } else {
            $actionName = '';
        }

        foreach (get_class_methods($this) as $method) {
            if (!preg_match('#^([a-z].*)Command$#', $method, $match)) {
                continue;
            }

            if ($actionName && $match[1] !== $actionName) {
                continue;
            }

            $rm = new \ReflectionMethod($this, $method);
            if (!$rm->isPublic()) {
                continue;
            }

            $lines = [];
            foreach (preg_split('#[\r\n]+#', $rm->getDocComment()) as $line) {
                $lines[] = trim($line, "\t /*\r\n");
            }

            $description = '';
            foreach ($lines as $line) {
                if (!$line) {
                    continue;
                }

                if ($line[0] !== '@') {
                    $description = $line;
                }
                break;
            }

            $command = $this->console->colorize(str_pad(basename($method, 'Command'), 10), Console::FC_YELLOW) . ' ' . $description;
            $this->console->writeLn($command);

            $defaultValues = [];
            foreach ($rm->getParameters() as $parameter) {
                if ($parameter->isDefaultValueAvailable()) {
                    $defaultValues[$parameter->getName()] = $parameter->getDefaultValue();
                }
            }

            $params = [];
            foreach ($lines as $line) {
                if (strpos($line, '@param') === false) {
                    continue;
                }

                $parts = preg_split('#\s+#', $line, 4);
                if (count($parts) < 3 || $parts[0] !== '@param') {
                    continue;
                }
                $name = substr($parts[2], 1);
                $type = $parts[1];

                if (isset($defaultValues[$name])) {
                    if ($type === 'bool' || $type === 'boolean') {
                        $defaultValues[$name] = $defaultValues[$name] ? 'YES' : 'NO';
                    } elseif ($type === 'int' || $type === 'integer') {
                        $defaultValues[$name] = (int)$defaultValues[$name];
                    } elseif ($type === 'float' || $type === 'double') {
                        $defaultValues[$name] = (float)$defaultValues[$name];
                    } elseif ($type === 'string') {
                        $defaultValues[$name] = json_encode($defaultValues[$name], JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE);
                    } elseif ($type === 'array') {
                        $defaultValues[$name] = json_encode($defaultValues[$name], JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE);
                    }
                }

                $params[$name] = isset($parts[3]) ? trim($parts[3]) : '';
            }

            if ($params) {
                $shortNames = [];
                foreach ($params as $name => $description) {
                    $short = $name[0];
                    if (isset($shortNames[$short])) {
                        $shortNames[$short] = false;
                    } else {
                        $shortNames[$short] = $name;
                    }
                }
                $shortNames = array_flip(array_filter($shortNames));

                $width = 1;
                foreach ($params as $name => $description) {
                    $width = max($width, strlen($name) + 2 + (isset($shortNames[$name]) ? 4 : 0));
                }
                $this->console->writeLn('  Options:');

                foreach ($params as $name => $value) {
                    $option = '--' . $name;
                    if (isset($shortNames[$name])) {
                        $option .= ', -' . $shortNames[$name];
                    }
                    $this->console->writeLn(['    :option :value :default',
                        'option' => $this->console->colorize($option, Console::FC_CYAN, $width),
                        'value' => $value ? "  $value" : '',
                        'default' => isset($defaultValues[$name]) ? " (default: $defaultValues[$name])" : '']);
                }
            }
        }
    }
215285
public function print()
    {
        // If there is no hints, print a message for that.
        if (count($this->hints) === 0) {
            $this->output->writeln('<fg=black;bg=green>Awesome! There is nothing from me to teach you!</>');
            $this->output->write("\n");
        } else {
            foreach ($this->hints as $hint) {
                $this->output->writeln('<info>'.$hint->filename.':'.$hint->lineno.'</>');
                $this->output->writeln("\t".$hint->type.': '.$hint->message." [$hint->link]");
                $this->output->write("\n");
            }
        }

        $this->output->writeln(count($this->files).' files checked, '.count($this->hints).' hints detected.');
    }
1154730
public function debug()
	{
	    $errorToreturn = '';
		if($this->_debug && $this->hasError() ){
			$message = $this->getMessage();
			$trace = $this->getTrace();
			$critical = $this->getCritical();

			for($i= 0, $count = sizeOf($message); $i<$count;$i++ ) {

				if($critical[$i]){
                    echo '<strong style="color:red">';
				} else  {
					continue;
				}

				CheckoutApi_Utility_Utilities::dump($message[$i] .'==> { ');
				
				foreach($trace[$i] as $errorIndex => $errors) {
                    echo   "<pre>";
                    echo    $errorIndex ."=>  "; print_r($errors);

                    echo   "</pre>";
				}
				
				if($critical[$i])	{
                    echo   '</strong>';
				}
				
				CheckoutApi_Utility_Utilities::dump('} ');
				
			}
			
		}
		return $errorToreturn;
	}
1008288
public function displayHelp()
    {
        printf("%s\n", $this->getUsage());
        printf("%s\n", $this->getDescription());


        // Les options non incluses dans un groupe
        if (count(self::$arr_opt)) {
            foreach (self::$arr_opt as $arg) {
                printf("%s\n", rtrim($arg));
            }
        }

        // Options faisant partie d’un groupe
        if (count(self::$arr_group)) {
            foreach (self::$arr_group as $group) {
                if (count($group->args)) {
                    print("\n\n");

                    if ($group->name) {
                        $name = $group->name;

                        if ($this->obj_color->label || $this->obj_color->bold) {
                            $name = new Ansi($name);

                            if ($this->obj_color->label) {
                                $name->fg($this->obj_color->label);
                            }

                            if ($this->obj_color->bold) {
                                $name->bold;
                            }
                        }

                        printf("%s\n", $name);
                    }
                    foreach ($group->args as $arg) {
                        printf("%s\n", rtrim($arg));
                    }
                }
            }
        }

        exit();
    }
22054
public function displayHelp() {
        $string = 'Using: ' . $this->script . ' ' . $this->command . ' ';
        $where = array();
        foreach ($this->parameters as $Option) {
            /** @var $Option Option */
            $short = $Option->getShort();
            $long = $Option->getLong();
            $temp = '-' . $short . '|--' . $long;
            if (!$Option->isRequired()) {
                $string .= '[' . $temp . '] ';
            } else {
                $string .= $temp . ' ';
            }

            $where[] = '-' . $short . ', --' . $long . '  - ' . $Option->getDescription();
        }
        $string .= "\n";
        $string .= implode("\n", $where) . "\n";
        echo $string;
        exit(0);
    }
947024
protected function showGeneralHelp()
    {
        $this->output->writeln("<yellow>Available commands:</yellow>");

        $longestName = 0;
        foreach ($this->app->getCommands() as $command) {
            $strlen = strlen($command->getName());
            if ($strlen > $longestName) {
                $longestName = $strlen;
            }
        }

        foreach ($this->app->getCommands() as $command) {
            $name = $command->getName();
            $this->output->write(str_pad("  <green>{$name}</green>", $longestName + 22, ' ', STR_PAD_RIGHT));
            $this->output->write("{$command->getDescription()}");
            $this->output->newline();
        }
    }
121134
private function _info()
    {
        if (empty($this->_output)) {
            return;
        }
        foreach ($this->_output as $result) {
            $dev = new UPSDevice();
            $status = "";
            $status2 = "";
            $status3 = "";
            $dev->setMode("SNMP");
            if (preg_match('/^\.1\.3\.6\.1\.4\.1\.318\.1\.1\.1\.1\.1\.2\.0 = STRING:\s(.*)/m', $result, $data)) {
                $dev->setName(trim($data[1], "\" \r\t"));
            }
            if (preg_match('/^\.1\.3\.6\.1\.4\.1\.318\.1\.1\.1\.1\.1\.1\.0 = STRING:\s(.*)/m', $result, $data)) {
                $dev->setModel(trim($data[1], "\" \r\t"));
            }
            if (preg_match('/^\.1\.3\.6\.1\.4\.1\.318\.1\.1\.1\.4\.1\.1\.0 = INTEGER:\s(.*)/m', $result, $data)) {
                switch (trim($data[1])) {
                    case 1: $status = "Unknown";
                            break;
                    case 2: $status = "On Line";
                            break;
                    case 3: $status = "On Battery";
                            break;
                    case 4: $status = "On Smart Boost";
                            break;
                    case 5: $status = "Timed Sleeping";
                            break;
                    case 6: $status = "Software Bypass";
                            break;
                    case 7: $status = "Off";
                            break;
                    case 8: $status = "Rebooting";
                            break;
                    case 9: $status = "Switched Bypass";
                            break;
                    case 10:$status = "Hardware Failure Bypass";
                            break;
                    case 11:$status = "Sleeping Until Power Returns";
                            break;
                    case 12:$status = "On Smart Trim";
                            break;
                   default: $status = "Unknown state (".trim($data[1]).")";
                            break;
                }
            }
            if (preg_match('/^\.1\.3\.6\.1\.4\.1\.318\.1\.1\.1\.2\.1\.1\.0 = INTEGER:\s(.*)/m', $result, $data)) {
                $batstat = "";
                switch (trim($data[1])) {
                    case 1: $batstat = "Battery Unknown";
                            break;
                    case 2: break;
                    case 3: $batstat = "Battery Low";
                            break;
                   default: $batstat = "Battery Unknown (".trim($data[1]).")";
                            break;
                }
                if ($batstat !== "") {
                    if ($status !== "") {
                        $status .= ", ".$batstat;
                    } else {
                        $status = $batstat;
                    }
                }
            }
            if (preg_match('/^\.1\.3\.6\.1\.4\.1\.318\.1\.1\.1\.2\.2\.4\.0 = INTEGER:\s(.*)/m', $result, $data)) {
                $batstat = "";
                switch (trim($data[1])) {
                    case 1: break;
                    case 2: $batstat = "Replace Battery";
                            break;
                   default: $batstat = "Replace Battery (".trim($data[1]).")";
                            break;
                }
                if ($batstat !== "") {
                    if ($status !== "") {
                        $status .= ", ".$batstat;
                    } else {
                        $status = $batstat;
                    }
                }
            }
            if ($status !== "") {
               $dev->setStatus(trim($status));
            }

            if (preg_match('/^\.1\.3\.6\.1\.4\.1\.318\.1\.1\.1\.3\.3\.1\.0 = Gauge32:\s(.*)/m', $result, $data)) {
                $dev->setLineVoltage(trim($data[1])/10);
            } elseif (preg_match('/^\.1\.3\.6\.1\.4\.1\.318\.1\.1\.1\.3\.2\.1\.0 = Gauge32:\s(.*)/m', $result, $data)) {
                $dev->setLineVoltage(trim($data[1]));
            }
            if (preg_match('/^\.1\.3\.6\.1\.4\.1\.318\.1\.1\.1\.4\.3\.3\.0 = Gauge32:\s(.*)/m', $result, $data)) {
                $dev->setLoad(trim($data[1])/10);
            } elseif (preg_match('/^\.1\.3\.6\.1\.4\.1\.318\.1\.1\.1\.4\.2\.3\.0 = Gauge32:\s(.*)/m', $result, $data)) {
                $dev->setLoad(trim($data[1]));
            }
            if (preg_match('/^\.1\.3\.6\.1\.4\.1\.318\.1\.1\.1\.2\.3\.4\.0 = INTEGER:\s(.*)/m', $result, $data)) {
                $dev->setBatteryVoltage(trim($data[1])/10);
            } elseif (preg_match('/^\.1\.3\.6\.1\.4\.1\.318\.1\.1\.1\.2\.2\.8\.0 = INTEGER:\s(.*)/m', $result, $data)) {
                $dev->setBatteryVoltage(trim($data[1]));
            }
            if (preg_match('/^\.1\.3\.6\.1\.4\.1\.318\.1\.1\.1\.2\.3\.1\.0 = Gauge32:\s(.*)/m', $result, $data)) {
                $dev->setBatterCharge(trim($data[1])/10);
            } elseif (preg_match('/^\.1\.3\.6\.1\.4\.1\.318\.1\.1\.1\.2\.2\.1\.0 = Gauge32:\s(.*)/m', $result, $data)) {
                $dev->setBatterCharge(trim($data[1]));
            }
            if (preg_match('/^\.1\.3\.6\.1\.4\.1\.318\.1\.1\.1\.2\.2\.3\.0 = Timeticks:\s\((\d*)\)/m', $result, $data)) {
                $dev->setTimeLeft(trim($data[1])/6000);
            }
            if (preg_match('/^\.1\.3\.6\.1\.4\.1\.318\.1\.1\.1\.2\.3\.2\.0 = Gauge32:\s(.*)/m', $result, $data)) {
                $dev->setTemperatur(trim($data[1])/10);
            } elseif (preg_match('/^\.1\.3\.6\.1\.4\.1\.318\.1\.1\.1\.2\.2\.2\.0 = Gauge32:\s(.*)/m', $result, $data)) {
                $dev->setTemperatur(trim($data[1]));
            }
            if (preg_match('/^\.1\.3\.6\.1\.4\.1\.318\.1\.1\.1\.2\.1\.3\.0 = STRING:\s(.*)/m', $result, $data)) {
                $dev->setBatteryDate(trim($data[1], "\" \r\t"));
            }
            if (preg_match('/^\.1\.3\.6\.1\.4\.1\.318\.1\.1\.1\.3\.3\.4\.0 = Gauge32:\s(.*)/m', $result, $data)) {
                $dev->setLineFrequency(trim($data[1])/10);
            } elseif (preg_match('/^\.1\.3\.6\.1\.4\.1\.318\.1\.1\.1\.3\.2\.4\.0 = Gauge32:\s(.*)/m', $result, $data)) {
                $dev->setLineFrequency(trim($data[1]));
            }

            $this->upsinfo->setUpsDevices($dev);
        }
    }
466880
public function status()
	{
		// Use 'porcelain' argument for consistent formatting of output
		$arguments = array('--porcelain');
		$status    = $this->call('status', $arguments);
		$response  = '';

		if (!empty($status))
		{
			$status = trim($status);
			$lines  = explode("\n", $status);

			$response = array(
				'added'     => array(),
				'modified'  => array(),
				'deleted'   => array(),
				'renamed'   => array(),
				'copied'    => array(),
				'untracked' => array(),
				'unmerged'  => array(),
				'merged'    => array()
			);
			foreach ($lines as $line)
			{
				$line  = trim($line);
				preg_match('/([A|D|M|U|R|C|?]{1,2})[ ]{1,2}([[:alnum:]_\-\.\/]*)/', $line, $parts);

				if (strlen($parts[1]) == 2 && $parts[1] != '??' && $parts[1] != 'UU')
				{
					$parts[1] = 'merged';
				}

				switch ($parts[1])
				{
					case 'A':
						$response['added'][] = $parts[2];
						break;
					case 'D':
						$response['deleted'][] = $parts[2];
						break;
					case 'M':
						$response['modified'][] = $parts[2];
						break;
					case 'R':
						$response['renamed'][] = $parts[2];
						break;
					case 'C':
						$response['copied'][] = $parts[2];
						break;
					case 'UU':
						$response['unmerged'][] = $parts[2];
						break;
					case '??':
						$response['untracked'][] = $parts[2];
						break;
					case 'merged':
						$response['merged'][] = $parts[2];
						break;
				}
			}
		}

		return $response;
	}
1053766
public function output()
    {
        // Print the description if it's defined.
        if ($this->description) {
            $this->climate->out($this->description)->br();
        }

        // Print the usage statement with the arguments without a prefix at the end.
        $this->climate->out("Usage: {$this->command} "
                            . $this->short($this->getOrderedArguments()));

        // Print argument details.
        foreach (['required', 'optional'] as $type) {
            $this->outputArguments($this->filter->{$type}(), $type);
        }
    }
898422
protected function outputBody()
    {
        // Only show error pages or generic "friendly" errors if the status code signifies
        // an error, and the response doesn't have any body yet that might contain
        // a more specific error description.
        $body = $this->getBody();
        if ($this->isError() && empty($body)) {
            /** @var HandlerInterface $handler */
            $handler = Injector::inst()->get(HandlerInterface::class);
            $formatter = $handler->getFormatter();
            echo $formatter->format([
                'code' => $this->statusCode,
            ]);
        } else {
            echo $this->body;
        }
    }
648397
private void printHelp() {
		System.out.println("./stratosphere <ACTION> [GENERAL_OPTIONS] [ARGUMENTS]");
		
		HelpFormatter formatter = new HelpFormatter();
		formatter.setWidth(80);
		formatter.setLeftPadding(5);
		formatter.setSyntaxPrefix("  general options:");
		formatter.printHelp(" ", GENRAL_OPTIONS);
		
		printHelpForRun();
		printHelpForInfo();
		printHelpForList();
		printHelpForCancel();
	}
88135
public function get_debug_string() {
		return 'status: '.$this->statuscode.' body:'.htmlentities($this->body).' errors: '.print_r($this->errors, true);
	}
486411
public function printSummary() {
    drush_print();

    // Print env files used for this definition.
    drush_print($this->formatHeading('Environment Definitions Found'));
    foreach ($this->loadedEnvs as $filename) {
      drush_print("{$filename}", 1);
    }

    drush_print();
    drush_print($this->formatHeading(dt("CONFIGURATION SUMMARY")));

    // We want to make sure they are printed in the same order as they will run.
    foreach ($this->getActiveDefinition() as $group => $options) {
      // Print a nice heading.
      $heading = $this->formatHeading($group);

      switch (strtolower($group)) {
        case 'modules':
          $this->printModuleSummary($options, $heading);
          break;

        case 'variables':
          $this->printVariableSummary($options, $heading);
          break;

        case 'permissions':
          $this->printPermissionSummary($options, $heading);
          break;

        case 'commands':
          $this->printCommandSummary($options, $heading);
          break;

        default:
          drush_print($this->formatHeading($group));
          drush_log(dt("I'm not sure what to do with '@group'.", ['@group' => $group]), 'warning');
          break;
      }
    }
  }
91725
public function printApplicationDetails()
    {
        $this->output->writeln($this->console->getName());

        if (!is_null($this->console->getVersion())) {
            $this->output->writeln('version '.$this->console->getVersion());
        }

        // New line padding
        $this->output->writeln('');
    }