From ac245666a2c2d1bfc055991bd021e8756232daa5 Mon Sep 17 00:00:00 2001 From: Thomas Gelf Date: Thu, 17 Mar 2016 01:12:16 +0100 Subject: [PATCH] Cli/ObjectCommand: add experimental flags --- library/Director/Cli/ObjectCommand.php | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/library/Director/Cli/ObjectCommand.php b/library/Director/Cli/ObjectCommand.php index 47fbc527..14eedf23 100644 --- a/library/Director/Cli/ObjectCommand.php +++ b/library/Director/Cli/ObjectCommand.php @@ -13,6 +13,13 @@ class ObjectCommand extends Command private $object; + private $experimental = array(); + + public function init() + { + $this->shiftExperimentalFlags(); + } + /** * Show a specific object * @@ -292,4 +299,20 @@ class ObjectCommand extends Command return $this->name; } + + protected function hasExperimental($flag) + { + return array_key_exists($flag, $this->experimentalFlags); + } + + protected function shiftExperimentalFlags() + { + if ($flags = $this->params->shift('experimental')) { + foreach (preg_split('/,/', $flags) as $flag) { + $this->experimentalFlags[$flag] = true; + } + } + + return $this; + } }