upgraded dependencies
This commit is contained in:
@@ -31,7 +31,7 @@ class MarkdownDescriptor extends Descriptor
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function describe(OutputInterface $output, $object, array $options = [])
|
||||
public function describe(OutputInterface $output, object $object, array $options = [])
|
||||
{
|
||||
$decorated = $output->isDecorated();
|
||||
$output->setDecorated(false);
|
||||
@@ -44,7 +44,7 @@ class MarkdownDescriptor extends Descriptor
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function write($content, $decorated = true)
|
||||
protected function write(string $content, bool $decorated = true)
|
||||
{
|
||||
parent::write($content, $decorated);
|
||||
}
|
||||
@@ -69,6 +69,9 @@ class MarkdownDescriptor extends Descriptor
|
||||
protected function describeInputOption(InputOption $option, array $options = [])
|
||||
{
|
||||
$name = '--'.$option->getName();
|
||||
if ($option->isNegatable()) {
|
||||
$name .= '|--no-'.$option->getName();
|
||||
}
|
||||
if ($option->getShortcut()) {
|
||||
$name .= '|-'.str_replace('|', '|-', $option->getShortcut()).'';
|
||||
}
|
||||
@@ -79,6 +82,7 @@ class MarkdownDescriptor extends Descriptor
|
||||
.'* Accept value: '.($option->acceptValue() ? 'yes' : 'no')."\n"
|
||||
.'* Is value required: '.($option->isValueRequired() ? 'yes' : 'no')."\n"
|
||||
.'* Is multiple: '.($option->isArray() ? 'yes' : 'no')."\n"
|
||||
.'* Is negatable: '.($option->isNegatable() ? 'yes' : 'no')."\n"
|
||||
.'* Default: `'.str_replace("\n", '', var_export($option->getDefault(), true)).'`'
|
||||
);
|
||||
}
|
||||
@@ -92,7 +96,9 @@ class MarkdownDescriptor extends Descriptor
|
||||
$this->write('### Arguments');
|
||||
foreach ($definition->getArguments() as $argument) {
|
||||
$this->write("\n\n");
|
||||
$this->write($this->describeInputArgument($argument));
|
||||
if (null !== $describeInputArgument = $this->describeInputArgument($argument)) {
|
||||
$this->write($describeInputArgument);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -104,7 +110,9 @@ class MarkdownDescriptor extends Descriptor
|
||||
$this->write('### Options');
|
||||
foreach ($definition->getOptions() as $option) {
|
||||
$this->write("\n\n");
|
||||
$this->write($this->describeInputOption($option));
|
||||
if (null !== $describeInputOption = $this->describeInputOption($option)) {
|
||||
$this->write($describeInputOption);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -114,12 +122,25 @@ class MarkdownDescriptor extends Descriptor
|
||||
*/
|
||||
protected function describeCommand(Command $command, array $options = [])
|
||||
{
|
||||
$command->getSynopsis();
|
||||
if ($options['short'] ?? false) {
|
||||
$this->write(
|
||||
'`'.$command->getName()."`\n"
|
||||
.str_repeat('-', Helper::width($command->getName()) + 2)."\n\n"
|
||||
.($command->getDescription() ? $command->getDescription()."\n\n" : '')
|
||||
.'### Usage'."\n\n"
|
||||
.array_reduce($command->getAliases(), function ($carry, $usage) {
|
||||
return $carry.'* `'.$usage.'`'."\n";
|
||||
})
|
||||
);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$command->mergeApplicationDefinition(false);
|
||||
|
||||
$this->write(
|
||||
'`'.$command->getName()."`\n"
|
||||
.str_repeat('-', Helper::strlen($command->getName()) + 2)."\n\n"
|
||||
.str_repeat('-', Helper::width($command->getName()) + 2)."\n\n"
|
||||
.($command->getDescription() ? $command->getDescription()."\n\n" : '')
|
||||
.'### Usage'."\n\n"
|
||||
.array_reduce(array_merge([$command->getSynopsis()], $command->getAliases(), $command->getUsages()), function ($carry, $usage) {
|
||||
@@ -132,9 +153,10 @@ class MarkdownDescriptor extends Descriptor
|
||||
$this->write($help);
|
||||
}
|
||||
|
||||
if ($command->getNativeDefinition()) {
|
||||
$definition = $command->getDefinition();
|
||||
if ($definition->getOptions() || $definition->getArguments()) {
|
||||
$this->write("\n\n");
|
||||
$this->describeInputDefinition($command->getNativeDefinition());
|
||||
$this->describeInputDefinition($definition);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -147,7 +169,7 @@ class MarkdownDescriptor extends Descriptor
|
||||
$description = new ApplicationDescription($application, $describedNamespace);
|
||||
$title = $this->getApplicationTitle($application);
|
||||
|
||||
$this->write($title."\n".str_repeat('=', Helper::strlen($title)));
|
||||
$this->write($title."\n".str_repeat('=', Helper::width($title)));
|
||||
|
||||
foreach ($description->getNamespaces() as $namespace) {
|
||||
if (ApplicationDescription::GLOBAL_NAMESPACE !== $namespace['id']) {
|
||||
@@ -163,7 +185,9 @@ class MarkdownDescriptor extends Descriptor
|
||||
|
||||
foreach ($description->getCommands() as $command) {
|
||||
$this->write("\n\n");
|
||||
$this->write($this->describeCommand($command));
|
||||
if (null !== $describeCommand = $this->describeCommand($command, $options)) {
|
||||
$this->write($describeCommand);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user