summaryrefslogtreecommitdiff
path: root/src/Script/Input.php
diff options
context:
space:
mode:
authorFbenas <philbeansburton@gmail.com>2018-05-07 14:42:15 +0100
committerFbenas <philbeansburton@gmail.com>2018-05-07 14:42:15 +0100
commit33f00442f1667d57f94433834e0da4985670025b (patch)
treeaa65df03e719f3d8024b0ea42a62aa7fd61f196e /src/Script/Input.php
parentc223ab602cbe7f6db7321ba547164971d63d7bcd (diff)
Get filtering working with output
Diffstat (limited to 'src/Script/Input.php')
-rw-r--r--src/Script/Input.php27
1 files changed, 23 insertions, 4 deletions
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 <phil@pgburton.com>
* @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 <phil@pgburton.com>
+ * @return string
+ */
+ public function getLongOptionString(): array
{
- return $this->availableOptions;
+ return $this->longOpts;
}
/**