From 11c34619985cb41873b9f196be3d0193f9897cc1 Mon Sep 17 00:00:00 2001 From: Chuck Hagenbuch Date: Thu, 4 Jun 2009 13:06:15 -0400 Subject: [PATCH] allow injecting the path or the argv_parser directly in the cli request constructor --- .../Controller/lib/Horde/Controller/Request/Cli.php | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/framework/Controller/lib/Horde/Controller/Request/Cli.php b/framework/Controller/lib/Horde/Controller/Request/Cli.php index ea3dd78ee..ec61c4758 100644 --- a/framework/Controller/lib/Horde/Controller/Request/Cli.php +++ b/framework/Controller/lib/Horde/Controller/Request/Cli.php @@ -13,7 +13,7 @@ */ /** - * Represents a command line invocation. + * Represents a command line request invocation. * * @author Mike Naberezny * @author Derek DeVries @@ -31,12 +31,24 @@ class Horde_Controller_Request_Cli extends Horde_Controller_Request_Base protected $_argv; /** + * Constructor + * + * In addition to the $options from Horde_Controller_Request_Base, you can + * pass a 'path' argument as a string, or a Horde_Argv_Parser object as + * 'argvParser' to override the path of the cli request. */ public function __construct($options = array()) { parent::__construct($options); - $this->setPath(); + $pathArgs = null; + if (isset($options['path'])) { + $pathArgs = $options['path']; + } elseif (isset($options['argvParser'])) { + $pathArgs = $options['argvParser']; + } + + $this->setPath($pathArgs); } public function getUri() -- 2.11.0