Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/spreed.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoas Schilling <213943+nickvergessen@users.noreply.github.com>2019-07-10 13:05:47 +0300
committerGitHub <noreply@github.com>2019-07-10 13:05:47 +0300
commitb4d39182f6906b2ca9f1a78eed9d7755d9f3345e (patch)
tree2a3998176dd0d6ad31dba20ff17861a7e31d658b /lib/Chat/Command/Executor.php
parent4bd464b5c006c2ff7bcdbdc0813f8ff9593bf9ec (diff)
parent4d693f0b5a8925f8e3780a49bbb3201d67e5d00b (diff)
Merge pull request #1918 from nextcloud/feature/noid/support-symfony-command-line-commands-with-help
Support symfony command lines with --help
Diffstat (limited to 'lib/Chat/Command/Executor.php')
-rw-r--r--lib/Chat/Command/Executor.php23
1 files changed, 21 insertions, 2 deletions
diff --git a/lib/Chat/Command/Executor.php b/lib/Chat/Command/Executor.php
index d5e316dbd..cfe8d8e53 100644
--- a/lib/Chat/Command/Executor.php
+++ b/lib/Chat/Command/Executor.php
@@ -121,7 +121,16 @@ class Executor {
$response = trim($response);
if (strpos($response, "\n")) {
- $helps[] = substr($response, 0, strpos($response, "\n"));
+ $tempHelp = substr($response, 0, strpos($response, "\n"));
+ if ($tempHelp === 'Description:') {
+ $hasHelpSection = strpos($response, "\nHelp:\n");
+ if ($hasHelpSection !== false) {
+ // Symfony console command with --help detected
+ $tempHelp = substr($response, $hasHelpSection + 7);
+ $tempHelp = substr($tempHelp, 0, strpos($tempHelp, "\n"));
+ }
+ }
+ $helps[] = $tempHelp;
} else {
$helps[] = $response;
}
@@ -140,7 +149,17 @@ class Executor {
$input = explode(' ', $arguments, 2);
if (count($input) === 1) {
$command = $this->commandService->find('', $arguments);
- return $this->execShell($room, $message, $command, '--help');
+ $response = $this->execShell($room, $message, $command, '--help');
+
+ if (strpos($response, 'Description:') === 0) {
+ $hasHelpSection = strpos($response, "\nHelp:\n");
+ if ($hasHelpSection !== false) {
+ // Symfony console command with --help detected
+ $response = substr($response, $hasHelpSection + 7);
+ }
+ }
+
+ return $response;
}
[$app, $cmd] = $input;