updated streamline-setup v2

This commit is contained in:
2025-01-15 08:53:49 -08:00
committed by alec.turner
parent a2ce9248f0
commit 4b569f81b0
20228 changed files with 2932048 additions and 63204 deletions
@@ -30,7 +30,7 @@ abstract class Command extends BaseCommand
*
* @api
*/
public function setApplication(Application $application = null): void
public function setApplication(?Application $application = null): void
{
if ($application !== null && !$application instanceof Shell) {
throw new \InvalidArgumentException('PsySH Commands require an instance of Psy\Shell');
@@ -39,6 +39,19 @@ abstract class Command extends BaseCommand
parent::setApplication($application);
}
/**
* getApplication, but is guaranteed to return a Shell instance.
*/
protected function getShell(): Shell
{
$shell = $this->getApplication();
if (!$shell instanceof Shell) {
throw new \RuntimeException('PsySH Commands require an instance of Psy\Shell');
}
return $shell;
}
/**
* {@inheritdoc}
*/
@@ -140,9 +153,11 @@ abstract class Command extends BaseCommand
$default = '';
}
$name = $argument->getName();
$pad = \str_pad('', $max - \strlen($name));
$description = \str_replace("\n", "\n".\str_pad('', $max + 2, ' '), $argument->getDescription());
$messages[] = \sprintf(" <info>%-{$max}s</info> %s%s", $argument->getName(), $description, $default);
$messages[] = \sprintf(' <info>%s</info>%s %s%s', $name, $pad, $description, $default);
}
$messages[] = '';