From b79c140c43f67a1612f372dd06ebffef637d3a87 Mon Sep 17 00:00:00 2001 From: "Alexander A. Klimov" Date: Tue, 30 May 2017 17:55:52 +0200 Subject: [PATCH] Correct CLI help text for modules refs #2801 --- library/Icinga/Cli/Command.php | 10 ++++++++++ library/Icinga/Cli/Documentation.php | 12 +++++++++++- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/library/Icinga/Cli/Command.php b/library/Icinga/Cli/Command.php index 00c24683d..117dbf66d 100644 --- a/library/Icinga/Cli/Command.php +++ b/library/Icinga/Cli/Command.php @@ -146,6 +146,16 @@ abstract class Command return $this->defaultActionName; } + /** + * Get {@link moduleName} + * + * @return string + */ + public function getModuleName() + { + return $this->moduleName; + } + public function hasDefaultActionName() { return $this->hasActionName($this->defaultActionName); diff --git a/library/Icinga/Cli/Documentation.php b/library/Icinga/Cli/Documentation.php index 35cb3804c..474b74f9c 100644 --- a/library/Icinga/Cli/Documentation.php +++ b/library/Icinga/Cli/Documentation.php @@ -91,6 +91,12 @@ class Documentation return $d; } + /** + * @param Command $command + * @param string $name + * + * @return string + */ protected function showCommandActions($command, $name) { $actions = $command->listActions(); @@ -103,7 +109,11 @@ class Documentation $this->getMethodTitle($command, $action) ); } - $d .= "\nShow help on a specific action: icingacli help $name \n"; + $d .= "\nShow help on a specific action: icingacli help "; + if ($command->isModule()) { + $d .= $command->getModuleName() . ' '; + } + $d .= "$name \n"; return $d; }