think\console\input\Definition::getSynopsis PHP Method

getSynopsis() public method

获取该指令的介绍
public getSynopsis ( boolean $short = false ) : string
$short boolean 是否简洁介绍
return string
    public function getSynopsis($short = false)
    {
        $elements = [];
        if ($short && $this->getOptions()) {
            $elements[] = '[options]';
        } elseif (!$short) {
            foreach ($this->getOptions() as $option) {
                $value = '';
                if ($option->acceptValue()) {
                    $value = sprintf(' %s%s%s', $option->isValueOptional() ? '[' : '', strtoupper($option->getName()), $option->isValueOptional() ? ']' : '');
                }
                $shortcut = $option->getShortcut() ? sprintf('-%s|', $option->getShortcut()) : '';
                $elements[] = sprintf('[%s--%s%s]', $shortcut, $option->getName(), $value);
            }
        }
        if (count($elements) && $this->getArguments()) {
            $elements[] = '[--]';
        }
        foreach ($this->getArguments() as $argument) {
            $element = '<' . $argument->getName() . '>';
            if (!$argument->isRequired()) {
                $element = '[' . $element . ']';
            } elseif ($argument->isArray()) {
                $element .= ' (' . $element . ')';
            }
            if ($argument->isArray()) {
                $element .= '...';
            }
            $elements[] = $element;
        }
        return implode(' ', $elements);
    }