Shows command help then aborts.

@return mixed
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);
    }
794295
public function cmdDeleteStore()
    {
        $id = $this->getParam(0);

        if (empty($id) || !is_numeric($id)) {
            $this->errorAndExit($this->text('Invalid argument'));
        }

        if (!$this->store->delete($id)) {
            $this->errorAndExit($this->text('Unexpected result'));
        }

        $this->output();
    }
853447
protected function abortCommandExecution()
    {
        $this->server = $this->checkEnv('server', 'ACACHA_FORGE_SERVER');
        $this->site = $this->checkEnv('site', 'ACACHA_FORGE_SITE');
        $this->dieIfEnvVarIsNotInstalled('ACACHA_FORGE_ACCESS_TOKEN');
    }
68336
protected function abortCommandExecution()
    {
        $this->domain = $this->checkEnv('domain', 'ACACHA_FORGE_DOMAIN', 'argument');
        $this->ip = $this->checkEnv('ip', 'ACACHA_FORGE_IP_ADDRESS', 'argument');

        if ($this->dnsResolutionIsOk()) {
            return ;
        }

        $this->checkForRootPermission();
    }
624924
public function completeCommand()
    {
        $arguments = array_slice($GLOBALS['argv'], 3);
        $position = (int)$arguments[0];

        $arguments = array_slice($arguments, 1);

        $count = count($arguments);

        $controller = null;
        if ($count > 1) {
            $controller = $arguments[1];
        }

        $command = null;
        if ($count > 2) {
            $command = $arguments[2];
            if ($command !== '' && $command[0] === '-') {
                $command = 'default';
            }
        }

        $previous = $position > 0 ? $arguments[$position - 1] : null;

        $current = isset($arguments[$position]) ? $arguments[$position] : '';

        if ($position === 1) {
            $words = $this->_getControllers();
        } elseif ($current !== '' && $current[0] === '-') {
            $words = $this->_getArgumentNames($controller, $command);
        } elseif ($position === 2) {
            $words = $this->_getCommands($controller);
        } else {
            $words = $this->_getArgumentValues($controller, $command, $previous);
        }

        $this->console->writeLn(implode(' ', $this->_filterWords($words, $current)));

        return 0;
    }
321829
public function actionStop()
    {
        $message = 'Stopping Yii 2 Daemon ' . $this->version . '... ';
        $result = static::EXIT_CODE_NORMAL;
        if ($this->_getPid() !== false) {
            $this->_killPid();
            $message .= 'OK.';
        } else {
            $message .= 'Service is not running!';
            $result = static::EXIT_CODE_ERROR;
        }
        echo $message . PHP_EOL;
        $this->_log($message);
        return $result;
    }
1295646
public function cmdDeleteCountry()
    {
        $code = $this->getParam(0);
        $all = $this->getParam('all');

        if (empty($code) && empty($all)) {
            $this->errorAndExit($this->text('Invalid command'));
        }

        $result = null;

        if (!empty($code)) {
            $result = $this->country->delete($code);
        } else if (!empty($all)) {

            $deleted = $count = 0;
            foreach ($this->country->getList() as $item) {
                $count++;
                $deleted += (int) $this->country->delete($item['code']);
            }

            $result = $count && $count == $deleted;
        }

        if (empty($result)) {
            $this->errorAndExit($this->text('Unexpected result'));
        }

        $this->output();
    }
671860
protected function showHelp(): bool
    {
        if (!$definition = $this->getDefinition()) {
            return false;
        }

        // if has InputDefinition object. (The comment of the command will not be parsed and used at this time.)
        $help = $definition->getSynopsis();
        // build usage
        $help['usage:'] = \sprintf(
            '%s %s %s',
            $this->getScriptName(),
            $this->getCommandName(),
            $help['usage:']
        );
        // align global options
        $help['global options:'] = FormatUtil::alignOptions(Application::getGlobalOptions());

        if (empty($help[0]) && $this->isAlone()) {
            $help[0] = self::getDescription();
        }

        if (empty($help[0])) {
            $help[0] = 'No description message for the command';
        }

        // output description
        $this->write(\ucfirst($help[0]) . \PHP_EOL);
        unset($help[0]);

        $this->output->mList($help, ['sepChar' => '  ']);
        return true;
    }
540213
public function handle()
    {
        if(!$this->verifyViewExists($this->option('view')))
        {
            $message  = "Aborting due to missing view. Your application will remain ";
            $message .= (file_exists($this->laravel->storagePath().'/framework/down')) ? "down from a previous down command." : "up.";
            $this->info($message);
            return false;
        }

        // Call the original method, writing to the down file & console output
        parent::handle();

        // Fire an event
        $payload = $this->getDownFilePayload();
        Event::dispatch(new MaintenanceModeEnabled($payload['time'], $payload['message'], $payload['view'], $payload['retry'], $payload['allowed']));
        return true;
    }
498242
protected function showHelp($error = null)
    {
        if ($error !== null) {
            $this->showError($error);
        }

        $message = 'Available commands:';
        echo PHP_EOL.PHP_EOL.$message.PHP_EOL.$this->getFlags()->getDefaults().PHP_EOL;
        exit;
    }
1013538
public function getHelp()
    {
        print Color::head('Help:') . PHP_EOL;
        print Color::colorize('  Lists the commands available in Console') . PHP_EOL . PHP_EOL;

        $this->run([]);
    }
294963
protected function doExecute()
    {
        $failer = $this->console->container->get('queue.failer');

        $all = $this->getOption('all');

        if ($all) {
            $ids = array_column($failer->all(), 'id');
        } else {
            $ids = $this->io->getArguments();

            if (!count($ids)) {
                throw new WrongArgumentException('No id provided');
            }
        }

        foreach ($ids as $id) {
            $failer->remove($id);

            if (!$all) {
                $this->out(sprintf('Remove failed-job: <info>%s</info>', $id));

                $failer->remove($id);
            }
        }

        if ($all) {
            $failer->clear();

            $this->out('All failed jobs cleared.');
        }

        return true;
    }
338276
function abort() {
		if (!headers_sent() && session_status()!=PHP_SESSION_ACTIVE)
			session_start();
		$out='';
		while (ob_get_level())
			$out=ob_get_clean().$out;
		if (!headers_sent()) {
			header('Content-Length: '.strlen($out));
			header('Connection: close');
		}
		session_commit();
		echo $out;
		flush();
		if (function_exists('fastcgi_finish_request'))
			fastcgi_finish_request();
	}
289763
protected function getValidCommand()
    {
        $datetimeFormat = $this->getDatetimeFormat();
        $type           = $this->type;
        $path           = $this->path;
        $command        = $this->command;
        $debug          = $this->debug;

        $match = '(\*|[0-9]{1,2}|\*\/[0-9]{1,2}|[0-9]{1,2}\s*\-\s*[0-9]{1,2}|(([0-9]{1,2})*\s*\,\s*[0-9]{1,2})+)\s+';

        if( ! preg_match('/^'.$match.$match.$match.$match.$match.'$/', $datetimeFormat) )
        {
            throw new InvalidTimeFormatException('Services', 'crontab:timeFormatError');
        }
        else
        {
            return $datetimeFormat.
                   ( ! empty($path)    ? $path    . ' ' : '' ).
                   ( ! empty($command) ? $command . ' ' : '' ).
                   ( ! empty($type)    ? $type    . ' ' : '' ).
                   ( $debug === true   ? '>> '    . $this->crontabDir . 'debug.log 2>&1' : '' );
        }
    }
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])" : '']);
                }
            }
        }
    }
662585
public function terminate()
    {
        if ($socket = end($this->sockets)) {
            // Quit the worker
            fwrite($socket, PHP_EOL);
        }

        // Return the process ID
        return key($this->sockets);
    }
970206
protected static function helpAction()
    {
        $class = new \ReflectionClass(static::getCurrentClass());
        $methods = $class->getMethods();
        $commands = array();
        $comments = array();
        $commandLen = 0;
        foreach ($methods as $method) {
            $methodName = (string) $method->getName();
            if (substr($methodName, -6, 6) == 'Action') {
                $command = substr($methodName, 0, strlen($methodName) - 6);
                $comment = preg_replace('#^[^a-zA-Z0-9_.()-]*(.*?)[^a-zA-Z0-9_.()-]*$#', '\1', $method->getDocComment());
                $commandLen = max(strlen($command), $commandLen);
                $commands[] = $command;
                $comments[] = $comment;
            }
        }
        $commandLen++;
        echo "\n  Usage: " . self::green() . basename($_SERVER['argv'][0]) . self::yellow() . ' <command>' . self::resetColor() . " [options]\n\n";
        foreach ($commands as $key => $command) {
            printf(self::yellow() . " %' " . $commandLen . 's' . self::resetColor() . ": %s\n", $command, $comments[$key]);
        }
        echo "\n";
    }