diff --git a/setup/cli/modules/class.module.php b/setup/cli/modules/class.module.php index 4ff5c7b1c55e73d8676945311086ff3857514126..bfe32969b9e891d87e27f99a96aacfe1c64e8bfd 100644 --- a/setup/cli/modules/class.module.php +++ b/setup/cli/modules/class.module.php @@ -80,6 +80,21 @@ class Option { } } +class OutputStream { + var $stream; + + function OutputStream() { + call_user_func_array(array($this, '__construct'), func_get_args()); + } + function __construct($stream) { + $this->stream = fopen($stream, 'w'); + } + + function write($what) { + fwrite($this->stream, $what); + } +} + class Module { var $options = array(); @@ -89,6 +104,9 @@ class Module { var $usage = '$script [options] $args [arguments]'; var $autohelp = true; + var $stdout; + var $stderr; + var $_options; var $_args; @@ -102,6 +120,8 @@ class Module { 'help'=>"Display this help message"); foreach ($this->options as &$opt) $opt = new Option($opt); + $this->stdout = new OutputStream('php://output'); + $this->stderr = new OutputStream('php://stderr'); } function showHelp() {