Commit 1d78d1b9 authored by lichtscheu's avatar lichtscheu

add functionality to allow hiding commands in /help command

parent b0833a89
...@@ -59,6 +59,13 @@ abstract class Command ...@@ -59,6 +59,13 @@ abstract class Command
*/ */
protected $usage = 'Command usage'; protected $usage = 'Command usage';
/**
* Show in Help
*
* @var bool
*/
protected $showInHelp = true;
/** /**
* Version * Version
* *
...@@ -252,6 +259,16 @@ abstract class Command ...@@ -252,6 +259,16 @@ abstract class Command
return $this->name; return $this->name;
} }
/*
* Get Show in Help
*
* @return bool
*/
public function getShowInHelp()
{
return $this->showInHelp;
}
/** /**
* Check if command is enabled * Check if command is enabled
* *
......
...@@ -69,12 +69,14 @@ class HelpCommand extends UserCommand ...@@ -69,12 +69,14 @@ class HelpCommand extends UserCommand
); );
foreach ($command_objs as $command) { foreach ($command_objs as $command) {
if($command->getShowInHelp()) {
$text .= sprintf( $text .= sprintf(
'/%s - %s' . PHP_EOL, '/%s - %s' . PHP_EOL,
$command->getName(), $command->getName(),
$command->getDescription() $command->getDescription()
); );
} }
}
$text .= PHP_EOL . 'For exact command help type: /help <command>'; $text .= PHP_EOL . 'For exact command help type: /help <command>';
} else { } else {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment