From 6f7fdef0f500cd4bb540affd3bc1482243f337c1 Mon Sep 17 00:00:00 2001 From: emkael Date: Wed, 24 Feb 2016 23:18:07 +0100 Subject: * Prado 3.3.0 --- .../3rdParty/PhpShell/PHP/Shell/Options.php | 132 +++++++++++++++++++++ 1 file changed, 132 insertions(+) create mode 100644 lib/prado/framework/3rdParty/PhpShell/PHP/Shell/Options.php (limited to 'lib/prado/framework/3rdParty/PhpShell/PHP/Shell/Options.php') diff --git a/lib/prado/framework/3rdParty/PhpShell/PHP/Shell/Options.php b/lib/prado/framework/3rdParty/PhpShell/PHP/Shell/Options.php new file mode 100644 index 0000000..8f5e57d --- /dev/null +++ b/lib/prado/framework/3rdParty/PhpShell/PHP/Shell/Options.php @@ -0,0 +1,132 @@ +registerCommand('#^:set #', $this, 'cmdSet', ':set ', 'set a shell variable'); + } + + /** + * register a option + * + * @param string name of the option + * @param object a object handle + * @param string method-name of the setor in the object + * @param string (unused) + */ + public function registerOption($option, $obj, $setor, $getor = null) { + if (!method_exists($obj, $setor)) { + throw new Exception(sprintf("setor %s doesn't exist on class %s", $setor, get_class($obj))); + } + + $this->options[trim($option)] = array("obj" => $obj, "setor" => $setor); + } + + /** + * set a shell-var + * + * :set al to enable autoload + * :set bg=dark to enable highlighting with a dark backgroud + */ + public function cmdSet($l) { + if (!preg_match('#:set\s+([a-z]+)\s*(?:=\s*([a-z0-9]+)\s*)?$#i', $l, $a)) { + print(':set failed: either :set