update patch 1

This commit is contained in:
fiqhpratama
2024-12-02 01:18:34 +07:00
parent 453d9bb470
commit 25026b0a85
3380 changed files with 103529 additions and 363623 deletions
+55 -11
View File
@@ -50,7 +50,7 @@ use Symfony\Component\Console\Output\OutputInterface;
*/
class Shell extends Application
{
const VERSION = 'v0.12.4';
const VERSION = 'v0.12.5';
private $config;
private $cleaner;
@@ -214,7 +214,7 @@ class Shell extends Application
new Command\TraceCommand(),
new Command\BufferCommand(),
new Command\ClearCommand(),
new Command\EditCommand($this->config->getRuntimeDir()),
new Command\EditCommand($this->config->getRuntimeDir(false)),
// new Command\PsyVersionCommand(),
$sudo,
$hist,
@@ -919,17 +919,58 @@ class Shell extends Application
$input = new ShellInput(\str_replace('\\', '\\\\', \rtrim($input, " \t\n\r\0\x0B;")));
if ($input->hasParameterOption(['--help', '-h'])) {
$helpCommand = $this->get('help');
if (!$helpCommand instanceof Command\HelpCommand) {
throw new RuntimeException('Invalid help command instance');
}
$helpCommand->setCommand($command);
if (!$input->hasParameterOption(['--help', '-h'])) {
try {
return $command->run($input, $this->output);
} catch (\Exception $e) {
if (!self::needsInputHelp($e)) {
throw $e;
}
return $helpCommand->run(new StringInput(''), $this->output);
$this->writeException($e);
$this->output->writeln('--');
if (!$this->config->theme()->compact()) {
$this->output->writeln('');
}
}
}
return $command->run($input, $this->output);
$helpCommand = $this->get('help');
if (!$helpCommand instanceof Command\HelpCommand) {
throw new RuntimeException('Invalid help command instance');
}
$helpCommand->setCommand($command);
return $helpCommand->run(new StringInput(''), $this->output);
}
/**
* Check whether a given input error would benefit from --help.
*
* @return bool
*/
private static function needsInputHelp(\Exception $e): bool
{
if (!($e instanceof \RuntimeException || $e instanceof SymfonyConsoleException)) {
return false;
}
$inputErrors = [
'Not enough arguments',
'option does not accept a value',
'option does not exist',
'option requires a value',
];
$msg = $e->getMessage();
foreach ($inputErrors as $errorMsg) {
if (\strpos($msg, $errorMsg) !== false) {
return true;
}
}
return false;
}
/**
@@ -1261,10 +1302,13 @@ class Shell extends Application
case \E_USER_NOTICE:
case \E_USER_DEPRECATED:
case \E_DEPRECATED:
case \E_STRICT:
return 'warning';
default:
if ((\PHP_VERSION_ID < 80400) && $severity === \E_STRICT) {
return 'warning';
}
return 'error';
}
} else {