From 33f00442f1667d57f94433834e0da4985670025b Mon Sep 17 00:00:00 2001 From: Fbenas Date: Mon, 7 May 2018 14:42:15 +0100 Subject: Get filtering working with output --- src/Script/Input.php | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) (limited to 'src/Script/Input.php') diff --git a/src/Script/Input.php b/src/Script/Input.php index 6b15c51..4e437dd 100644 --- a/src/Script/Input.php +++ b/src/Script/Input.php @@ -19,7 +19,15 @@ class Input * * @var string */ - protected $availableOptions = 'fdtlc::'; + protected $shortOpts = 'f:d::t::l::c::'; + + protected $longOpts = [ + 'filename:', + 'day::', + 'time::', + 'location::', + 'covers::' + ]; /** * The loaded CLI options @@ -45,7 +53,7 @@ class Input */ protected function loadOptions() { - $this->options = getopt($this->getOptionString()); + $this->options = getopt($this->getShortOptionString(), $this->getLongOptionString()); if (!array_key_exists('f', $this->options)) { throw new Exception('Filename Option `-f` is required'); @@ -63,9 +71,20 @@ class Input * @author Phil Burton * @return string */ - public function getOptionString(): string + public function getShortOptionString(): string + { + return $this->shortOpts; + } + + /** + * Return the option string for the options we want to load + * + * @author Phil Burton + * @return string + */ + public function getLongOptionString(): array { - return $this->availableOptions; + return $this->longOpts; } /** -- cgit v1.2.3