Skip to content

Commit f5067af

Browse files
damiankloipweitzman
authored andcommitted
Fixes #3595: Remove non-default options in REPL commands, Fix help command grouping (#3667)
1 parent feb0406 commit f5067af

File tree

2 files changed

+17
-17
lines changed

2 files changed

+17
-17
lines changed

src/Drupal/Commands/core/CliCommands.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515

1616
class CliCommands extends DrushCommands
1717
{
18+
1819
/**
1920
* Drush's PHP Shell.
2021
*
@@ -94,14 +95,13 @@ protected function getDrushCommands()
9495
$ignored_commands = [
9596
'help',
9697
'php:cli',
97-
'core:cli',
98-
'core-cli',
99-
'php',
98+
'core:cli',
99+
'php',
100100
'php:eval',
101-
'eval',
102-
'ev',
101+
'eval',
102+
'ev',
103103
'php:script',
104-
'scr',
104+
'scr',
105105
];
106106
$php_keywords = $this->getPhpKeywords();
107107

src/Psysh/DrushCommand.php

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public function __construct(AnnotatedCommand $command)
4343
*/
4444
public function getNamespace()
4545
{
46-
$parts = explode('-', $this->getName());
46+
$parts = explode(':', $this->getName());
4747
return count($parts) >= 2 ? array_shift($parts) : 'global';
4848
}
4949

@@ -53,11 +53,11 @@ public function getNamespace()
5353
protected function configure()
5454
{
5555
$this
56-
->setName($this->command->getName())
57-
->setAliases($this->command->getAliases())
58-
->setDefinition($this->command->getDefinition())
59-
->setDescription($this->command->getDescription())
60-
->setHelp($this->buildHelpFromCommand());
56+
->setName($this->command->getName())
57+
->setAliases($this->command->getAliases())
58+
->setDefinition($this->command->getDefinition())
59+
->setDescription($this->command->getDescription())
60+
->setHelp($this->buildHelpFromCommand());
6161
}
6262

6363
/**
@@ -73,20 +73,20 @@ protected function execute(InputInterface $input, OutputInterface $output)
7373
if (strpos($first, '@') === 0) {
7474
$alias = $first;
7575
$command = array_shift($args);
76-
} // Otherwise, default the alias to '@self' and use the first argument as the
77-
// command.
78-
else {
76+
} else {
77+
// Otherwise, default the alias to '@self' and use the first argument as the
78+
// command.
7979
$alias = '@self';
8080
$command = $first;
8181
}
8282

83-
$options = $input->getOptions();
83+
$options = array_diff_assoc($input->getOptions(), $this->getDefinition()->getOptionDefaults());
8484
// Force the 'backend' option to TRUE.
8585
$options['backend'] = true;
8686

8787
$return = drush_invoke_process($alias, $command, array_values($args), $options, ['interactive' => true]);
8888

89-
if ($return['error_status'] > 0) {
89+
if (($return['error_status'] > 0) && !empty($return['error_log'])) {
9090
foreach ($return['error_log'] as $error_type => $errors) {
9191
$output->write($errors);
9292
}

0 commit comments

Comments
 (0)