From 92690474d58dba9e389c6b687ce6bf1d61a8d6aa Mon Sep 17 00:00:00 2001
From: Jared Hancock <jared@osticket.com>
Date: Thu, 6 Jun 2013 11:46:36 -0500
Subject: [PATCH] Add defaults to parsed command-line options

---
 setup/cli/modules/class.module.php | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/setup/cli/modules/class.module.php b/setup/cli/modules/class.module.php
index 501e6534e..70c2eebeb 100644
--- a/setup/cli/modules/class.module.php
+++ b/setup/cli/modules/class.module.php
@@ -142,6 +142,8 @@ class Module {
         $this->parseOptions();
         if (isset($this->_options[$name]))
             return $this->_options[$name];
+        elseif ($this->options[$name]->default)
+            return $this->options[$name]->default;
         else
             return $default;
     }
@@ -167,6 +169,10 @@ class Module {
             else
                 $this->_args[$name] = &$this->_args[$idx];
 
+        foreach ($this->options as $name=>$opt)
+            if (!isset($this->_options[$name]))
+                $this->_options[$name] = $opt->default;
+
         if ($this->autohelp && $this->getOption('help')) {
             $this->showHelp();
             die();
-- 
GitLab