本文整理匯總了PHP中Console_CommandLine::fromXmlFile方法的典型用法代碼示例。如果您正苦於以下問題:PHP Console_CommandLine::fromXmlFile方法的具體用法?PHP Console_CommandLine::fromXmlFile怎麽用?PHP Console_CommandLine::fromXmlFile使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Console_CommandLine
的用法示例。
在下文中一共展示了Console_CommandLine::fromXmlFile方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: run
public function run()
{
$this->concentrator = new Concentrate_Concentrator();
$this->parser = Console_CommandLine::fromXmlFile($this->getUiXml());
try {
$result = $this->parser->parse();
$this->setOptions($result->options);
$this->setWebRoot($result->args['webroot']);
$this->loadDataFiles();
if ($this->combine) {
$this->writeCombinedFiles();
$this->writeCombinedFlagFile();
}
if ($this->compile) {
$this->writeCompiledFiles();
$this->writeCompiledFlagFile();
}
if ($this->minify) {
$this->writeMinifiedFiles();
$this->writeMinifiedFlagFile();
}
} catch (Console_CommandLine_Exception $e) {
$this->displayError($e->getMessage() . PHP_EOL);
} catch (Exception $e) {
$this->displayError($e->getMessage() . PHP_EOL, false);
$this->displayError($e->getTraceAsString() . PHP_EOL);
}
}
示例2: getCommandLineParser
/**
* Gets the CLI parser for this pinentry
*
* @return Console_CommandLine the CLI parser for this pinentry.
*/
protected function getCommandLineParser()
{
return Console_CommandLine::fromXmlFile($this->getUIXML());
}
示例3: dirname
* http://opensource.org/licenses/mit-license.php
*
* @category Console
* @package Console_CommandLine
* @author David JEAN LOUIS <izimobil@gmail.com>
* @copyright 2007 David JEAN LOUIS
* @license http://opensource.org/licenses/mit-license.php MIT License
* @version CVS: $Id$
* @link http://pear.php.net/package/Console_CommandLine
* @since File available since release 0.1.0
*/
// Include the Console_CommandLine package.
require_once 'Console/CommandLine.php';
// create the parser
$xmlfile = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'ex4.xml';
$parser = Console_CommandLine::fromXmlFile($xmlfile);
// run the parser
try {
$result = $parser->parse();
if ($result->command_name) {
$st = $result->command->options['reverse'] ? strrev($result->command->args['text']) : $result->command->args['text'];
if ($result->command_name == 'foo') {
echo "Foo says: {$st}\n";
} else {
if ($result->command_name == 'bar') {
echo "Bar says: {$st}\n";
}
}
}
} catch (Exception $exc) {
$parser->displayError($exc->getMessage());