• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP ConsoleOptionParser类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中ConsoleOptionParser的典型用法代码示例。如果您正苦于以下问题:PHP ConsoleOptionParser类的具体用法?PHP ConsoleOptionParser怎么用?PHP ConsoleOptionParser使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了ConsoleOptionParser类的16个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: getOptionParser

 public function getOptionParser()
 {
     $parser = new ConsoleOptionParser($this->name);
     $parser->description(__('RADIUSdesk console for various tasks'));
     $parser->addOption('ping', array('help' => 'Do a ping monitor test', 'boolean' => true));
     $parser->addOption('heartbeat', array('help' => 'Do a heartbeat monitor test', 'boolean' => true));
     $parser->addArgument('action', array('help' => 'The action to do', 'required' => true, 'choices' => array('mon', 'restart_check', 'debug_check', 'auto_close')));
     $parser->epilog('Have alot of fun....');
     return $parser;
 }
开发者ID:smartwifi,项目名称:stores-rd,代码行数:10,代码来源:RdShell.php


示例2: __construct

/**
 * Make a new Subcommand
 *
 * @param string|array $name The long name of the subcommand, or an array with all the properties.
 * @param string $help The help text for this option
 * @param ConsoleOptionParser|array $parser A parser for this subcommand. Either a ConsoleOptionParser, or an array that can be
 *   used with ConsoleOptionParser::buildFromArray()
 */
	public function __construct($name, $help = '', $parser = null) {
		if (is_array($name) && isset($name['name'])) {
			foreach ($name as $key => $value) {
				$this->{'_' . $key} = $value;
			}
		} else {
			$this->_name = $name;
			$this->_help = $help;
			$this->_parser = $parser;
		}
		if (is_array($this->_parser)) {
			$this->_parser['command'] = $this->_name;
			$this->_parser = ConsoleOptionParser::buildFromArray($this->_parser);
		}
	}
开发者ID:hungnt88,项目名称:5stars-1,代码行数:23,代码来源:ConsoleInputSubcommand.php


示例3: buildFromArray

 /**
  * Build a parser from an array. Uses an array like
  *
  * {{{
  * $spec = array(
  *		'description' => 'text',
  *		'epilog' => 'text',
  *		'arguments' => array(
  *			// list of arguments compatible with addArguments.
  *		),
  *		'options' => array(
  *			// list of options compatible with addOptions
  *		),
  *		'subcommands' => array(
  *			// list of subcommands to add.
  *		)
  * );
  * }}}
  *
  * @param array $spec The spec to build the OptionParser with.
  * @return ConsoleOptionParser
  */
 public static function buildFromArray($spec)
 {
     $parser = new ConsoleOptionParser($spec['command']);
     if (!empty($spec['arguments'])) {
         $parser->addArguments($spec['arguments']);
     }
     if (!empty($spec['options'])) {
         $parser->addOptions($spec['options']);
     }
     if (!empty($spec['subcommands'])) {
         $parser->addSubcommands($spec['subcommands']);
     }
     if (!empty($spec['description'])) {
         $parser->description($spec['description']);
     }
     if (!empty($spec['epilog'])) {
         $parser->epilog($spec['epilog']);
     }
     return $parser;
 }
开发者ID:abhinav67,项目名称:prodigy2,代码行数:42,代码来源:ConsoleOptionParser.php


示例4: getOptionParser

 public function getOptionParser()
 {
     $options = array('working' => array('short' => 'w', 'help' => __('Set working directory for project to be baked in.'), 'boolean' => false), 'skel' => array('short' => 's', 'help' => __('Skel to bake from.'), 'boolean' => false, 'default' => $this->_pluginPath('BakingPlate') . 'Console' . DS . 'Templates' . DS . 'skel'), 'config' => array('short' => 'c', 'help' => __('Config file of submodules to bake into project.'), 'boolean' => false), 'group' => array('short' => 'g', 'help' => __('Specify a group of submodules, or core will be used.'), 'boolean' => false));
     return ConsoleOptionParser::buildFromArray(array('command' => 'plate', 'description' => __('BakingPlate Plate Shell Help.'), 'options' => array('group' => $options['group'], 'config' => $options['config']), 'subcommands' => array('init' => array('help' => __('Initializes BakingPlate tweaks onto an existing project'), 'parser' => array('description' => array(__('Initializes a git repository'), __('Makes necessary folders writeable'), __('Adds core (or specified) plugins to the project')), 'options' => array('config' => $options['config'], 'group' => $options['group']))), 'bake' => array('help' => __('Generates a new app using bakeplate.'), 'parser' => array('description' => __('The plate shell will bake a project from a skel. It will then add submodules and set permissions on folders.'), 'options' => array('working' => $options['working'], 'skel' => $options['skel'], 'config' => $options['config'], 'group' => array_merge(array('default' => 'core'), $options['group'])), 'arguments' => array('working' => array()))), 'browse' => array('help' => __('List available submodules.'), 'parser' => array('description' => __('Browse listed submodules (or groups of submodules) via name or index number.'), 'options' => array('group' => $options['group'], 'config' => $options['config']), 'arguments' => array('group' => array('help' => __('name or number of group.'), 'required' => false)))), 'add' => array('help' => __('Add specific submodule.'), 'parser' => array('description' => __('Add individual plugins as submodules to your project'), 'options' => array('group' => $options['group']), 'arguments' => array('submodule' => array('help' => __('Submodule to be added.'), 'required' => true)))), 'all' => array('help' => __('All submodules in a specified batch group'), 'parser' => array('description' => __('All submodules in a specified batch group'), 'options' => array(), 'arguments' => array())), 'search' => array('help' => __('Search for a specific submodule to install from CakePackages.com'), 'parser' => array('description' => __('Search <info>cakepackages.com</info> for Vendors or Plugins to add as submodules to Application'), 'options' => array(), 'arguments' => array('term' => array('help' => __('Search for a Cake Package to be add.'), 'required' => true)))))));
 }
开发者ID:novrian,项目名称:BakingPlate,代码行数:5,代码来源:PlateShell.php


示例5: getOptionParser

 /**
  * Gets the option parser instance and configures it.
  *
  * @return ConsoleOptionParser
  */
 public function getOptionParser()
 {
     $parser = new ConsoleOptionParser($this->name);
     $parser->description(__d('cake_console', 'The CakePHP Testsuite allows you to run test cases from the command line'))->addArgument('category', array('help' => __d('cake_console', 'The category for the test, or test file, to test.'), 'required' => false))->addArgument('file', array('help' => __d('cake_console', 'The path to the file, or test file, to test.'), 'required' => false))->addOption('log-junit', array('help' => __d('cake_console', '<file> Log test execution in JUnit XML format to file.'), 'default' => false))->addOption('log-json', array('help' => __d('cake_console', '<file> Log test execution in JSON format to file.'), 'default' => false))->addOption('log-tap', array('help' => __d('cake_console', '<file> Log test execution in TAP format to file.'), 'default' => false))->addOption('log-dbus', array('help' => __d('cake_console', 'Log test execution to DBUS.'), 'default' => false))->addOption('coverage-html', array('help' => __d('cake_console', '<dir> Generate code coverage report in HTML format.'), 'default' => false))->addOption('coverage-clover', array('help' => __d('cake_console', '<file> Write code coverage data in Clover XML format.'), 'default' => false))->addOption('testdox-html', array('help' => __d('cake_console', '<file> Write agile documentation in HTML format to file.'), 'default' => false))->addOption('testdox-text', array('help' => __d('cake_console', '<file> Write agile documentation in Text format to file.'), 'default' => false))->addOption('filter', array('help' => __d('cake_console', '<pattern> Filter which tests to run.'), 'default' => false))->addOption('group', array('help' => __d('cake_console', '<name> Only runs tests from the specified group(s).'), 'default' => false))->addOption('exclude-group', array('help' => __d('cake_console', '<name> Exclude tests from the specified group(s).'), 'default' => false))->addOption('list-groups', array('help' => __d('cake_console', 'List available test groups.'), 'boolean' => true))->addOption('loader', array('help' => __d('cake_console', 'TestSuiteLoader implementation to use.'), 'default' => false))->addOption('repeat', array('help' => __d('cake_console', '<times> Runs the test(s) repeatedly.'), 'default' => false))->addOption('tap', array('help' => __d('cake_console', 'Report test execution progress in TAP format.'), 'boolean' => true))->addOption('testdox', array('help' => __d('cake_console', 'Report test execution progress in TestDox format.'), 'default' => false, 'boolean' => true))->addOption('no-colors', array('help' => __d('cake_console', 'Do not use colors in output.'), 'boolean' => true))->addOption('stderr', array('help' => __d('cake_console', 'Write to STDERR instead of STDOUT.'), 'boolean' => true))->addOption('stop-on-error', array('help' => __d('cake_console', 'Stop execution upon first error or failure.'), 'boolean' => true))->addOption('stop-on-failure', array('help' => __d('cake_console', 'Stop execution upon first failure.'), 'boolean' => true))->addOption('stop-on-skipped', array('help' => __d('cake_console', 'Stop execution upon first skipped test.'), 'boolean' => true))->addOption('stop-on-incomplete', array('help' => __d('cake_console', 'Stop execution upon first incomplete test.'), 'boolean' => true))->addOption('strict', array('help' => __d('cake_console', 'Mark a test as incomplete if no assertions are made.'), 'boolean' => true))->addOption('wait', array('help' => __d('cake_console', 'Waits for a keystroke after each test.'), 'boolean' => true))->addOption('process-isolation', array('help' => __d('cake_console', 'Run each test in a separate PHP process.'), 'boolean' => true))->addOption('no-globals-backup', array('help' => __d('cake_console', 'Do not backup and restore $GLOBALS for each test.'), 'boolean' => true))->addOption('static-backup', array('help' => __d('cake_console', 'Backup and restore static attributes for each test.'), 'boolean' => true))->addOption('syntax-check', array('help' => __d('cake_console', 'Try to check source files for syntax errors.'), 'boolean' => true))->addOption('bootstrap', array('help' => __d('cake_console', '<file> A "bootstrap" PHP file that is run before the tests.'), 'default' => false))->addOption('configuration', array('help' => __d('cake_console', '<file> Read configuration from XML file.'), 'default' => false))->addOption('no-configuration', array('help' => __d('cake_console', 'Ignore default configuration file (phpunit.xml).'), 'boolean' => true))->addOption('include-path', array('help' => __d('cake_console', '<path(s)> Prepend PHP include_path with given path(s).'), 'default' => false))->addOption('directive', array('help' => __d('cake_console', 'key[=value] Sets a php.ini value.'), 'default' => false))->addOption('fixture', array('help' => __d('cake_console', 'Choose a custom fixture manager.')))->addOption('debug', array('help' => __d('cake_console', 'More verbose output.')));
     return $parser;
 }
开发者ID:medinaccesar,项目名称:blogcake,代码行数:11,代码来源:TestShell.php


示例6: getOptionParser

 /**
  * ConvertShell::getOptionParser()
  *
  * @return ConsoleOptionParser
  */
 public function getOptionParser()
 {
     $subcommandParser = array('options' => array('plugin' => array('short' => 'p', 'help' => 'The plugin to update. Only the specified plugin will be updated.', 'default' => ''), 'dry-run' => array('short' => 'd', 'help' => 'Dry run the update, no files will actually be modified.', 'boolean' => true), 'ext' => array('short' => 'e', 'help' => 'The extension(s) to search. A pipe delimited list, or a preg_match compatible subpattern', 'default' => 'php')), 'arguments' => ['path' => ['help' => 'Path to folder, defaults to current APP otherwise.']]);
     $name = ($this->plugin ? $this->plugin . '.' : '') . $this->name;
     $parser = new ConsoleOptionParser($name);
     return $parser->description("A shell to help automate upgrading array syntax to PHP5.4")->addSubcommand('run', array('help' => 'Update verbose array syntax to short one.', 'parser' => $subcommandParser));
 }
开发者ID:edukondaluetg,项目名称:cakephp-upgrade,代码行数:12,代码来源:ArraysShell.php


示例7: getOptionParser

 /**
  * getOptionParser
  *
  * @return array
  */
 public function getOptionParser()
 {
     return ConsoleOptionParser::buildFromArray(array('command' => 'Oven.bake', 'description' => array('Bakes an Oven recipe')));
 }
开发者ID:shama,项目名称:oven,代码行数:9,代码来源:BakeShell.php


示例8: getOptionParser

 /**
  * ConvertShell::getOptionParser()
  *
  * @return ConsoleOptionParser
  */
 public function getOptionParser()
 {
     $subcommandParser = array('options' => array('plugin' => array('short' => 'p', 'help' => __d('cake_console', 'The plugin to update. Only the specified plugin will be updated.'), 'default' => ''), 'dry-run' => array('short' => 'd', 'help' => __d('cake_console', 'Dry run the update, no files will actually be modified.'), 'boolean' => true), 'ext' => array('short' => 'e', 'help' => __d('cake_console', 'The extension(s) to search. A pipe delimited list, or a preg_match compatible subpattern'), 'default' => 'php')));
     $name = ($this->plugin ? $this->plugin . '.' : '') . $this->name;
     $parser = new ConsoleOptionParser($name);
     return $parser->description(__d('cake_console', "A shell to help automate upgrading array syntax to PHP5.4"))->addSubcommand('arrays', array('help' => __d('cake_console', 'Main method to update verbose array syntax to short one.'), 'parser' => $subcommandParser));
 }
开发者ID:sanjeevkumar12,项目名称:cakephp-upgrade,代码行数:12,代码来源:ConvertShell.php


示例9: getOptionParser

 public function getOptionParser()
 {
     $options = array('theme' => array('short' => 't', 'help' => __('Set theme to place Bootstrap files in.'), 'boolean' => false), 'webroot' => array('short' => 'w', 'help' => __('Set file output to webroot Theme dir (use with theme option).'), 'boolean' => true));
     return ConsoleOptionParser::buildFromArray(array('command' => 'copy', 'description' => __('TwitterBootstrap Copy Shell Help.'), 'options' => array('theme' => $options['theme'], 'webroot' => $options['webroot']), 'subcommands' => array('all' => array('help' => __('Copies Less, Js & Img source from Bootstrap submodule in plugin Vendor dir'), 'parser' => array('description' => array(__('files will be placed in webroot of App or named Theme')), 'options' => array('theme' => $options['theme'], 'webroot' => $options['webroot']))), 'less' => array('help' => __('Copies Less source from Bootstrap submodule in plugin Vendor dir'), 'parser' => array('description' => array(__('files will be placed in webroot/css/lib/ of App or named Theme')), 'options' => array('theme' => $options['theme'], 'webroot' => $options['webroot']))), 'img' => array('help' => __('Copies Img source from Bootstrap submodule in plugin Vendor dir'), 'parser' => array('description' => array(__('files will be placed in webroot/img/ of App or named Theme')), 'options' => array('theme' => $options['theme'], 'webroot' => $options['webroot']))), 'js' => array('help' => __('Copies Js source from Bootstrap submodule in plugin Vendor dir'), 'parser' => array('description' => array(__('files will be placed in webroot/js/lib of App or named Theme')), 'options' => array('theme' => $options['theme'], 'webroot' => $options['webroot']))))));
 }
开发者ID:ByMyHandsOnly,项目名称:BMHO_Web,代码行数:5,代码来源:CopyShell.php


示例10: getOptionParser

 /**
  * getOptionParser
  *
  * @return array
  */
 public function getOptionParser()
 {
     return ConsoleOptionParser::buildFromArray(array('command' => 'Oven.init', 'description' => array(__d('oven', 'Automatically initialize Oven')), 'options' => $this->_options));
 }
开发者ID:shama,项目名称:oven,代码行数:9,代码来源:InitShell.php


示例11: getOptionParser

 /**
  * {@inheritdoc}
  */
 public function getOptionParser()
 {
     return ConsoleOptionParser::buildFromArray(array('command' => 'clear_cache', 'description' => array(__d('webmaster', "Clear application's cache")), 'options' => array('expired' => array('help' => __d('webmaster', 'Cache configuration to use in conjunction with `toolkit clear`.'), 'short' => 'e', 'boolean' => true, 'default' => false), 'config' => array('help' => __d('webmaster', "Specify the cache configuration's name."), 'short' => 'c', 'choices' => Cache::configured()))));
 }
开发者ID:gourmet,项目名称:webmaster,代码行数:7,代码来源:ClearCacheTask.php


示例12: testParsingWithSubParser

 /**
  * test that parse() takes a subcommand argument, and that the subcommand parser
  * is used.
  *
  * @return void
  */
 public function testParsingWithSubParser()
 {
     $parser = new ConsoleOptionParser('test', FALSE);
     $parser->addOption('primary')->addArgument('one', array('required' => TRUE, 'choices' => array('a', 'b')))->addArgument('two', array('required' => TRUE))->addSubcommand('sub', array('parser' => array('options' => array('secondary' => array('boolean' => TRUE), 'fourth' => array('help' => 'fourth option')), 'arguments' => array('sub_arg' => array('choices' => array('c', 'd'))))));
     $result = $parser->parse(array('--secondary', '--fourth', '4', 'c'), 'sub');
     $expected = array(array('secondary' => TRUE, 'fourth' => '4', 'help' => FALSE, 'verbose' => FALSE, 'quiet' => FALSE), array('c'));
     $this->assertEquals($expected, $result, 'Sub parser did not parse request.');
 }
开发者ID:mrbadao,项目名称:api-official,代码行数:14,代码来源:ConsoleOptionParserTest.php


示例13: getOptionParser

 /**
  * getOptionParser
  *
  * @return array
  */
 public function getOptionParser()
 {
     return ConsoleOptionParser::buildFromArray(array('command' => 'Oven.merge', 'description' => array('Merges two classes.'), 'arguments' => array('from' => array('help' => __d('Oven', 'Class to merge from, `Controller/CommentsController`.'), 'required' => true), 'to' => array('help' => __d('Oven', 'Class to merge to, `Controller/BlogsController`.'), 'required' => true))));
 }
开发者ID:shama,项目名称:oven,代码行数:9,代码来源:MergeShell.php


示例14: testXmlHelpAsObject

 /**
  * Test xml help as object
  *
  * @return void
  */
 public function testXmlHelpAsObject()
 {
     $parser = new ConsoleOptionParser('mycommand', false);
     $parser->addOption('test', array('help' => 'A test option.'))->addArgument('model', array('help' => 'The model to make.', 'required' => true))->addArgument('other_longer', array('help' => 'Another argument.'));
     $formatter = new HelpFormatter($parser);
     $result = $formatter->xml(false);
     $this->assertInstanceOf('SimpleXmlElement', $result);
 }
开发者ID:SebFav,项目名称:ApplicationInternet2,代码行数:13,代码来源:HelpFormatterTest.php


示例15: getOptionParser

 public function getOptionParser()
 {
     return ConsoleOptionParser::buildFromArray(array('description' => array(__("Export images containing a given Tag cropped")), 'arguments' => array('dest' => array('help' => __('path where will be stored output images'), 'required' => true), 'tagId' => array('help' => __('Tag Id'))), 'options' => array()));
 }
开发者ID:bjoern-tantau,项目名称:digikamWebUi,代码行数:4,代码来源:ExtractTagShell.php


示例16: _displayHelp

/**
 * Display the help in the correct format
 *
 * @param string $command
 * @return void
 */
	protected function _displayHelp($command) {
		$format = 'text';
		if (!empty($this->args[0]) && $this->args[0] == 'xml') {
			$format = 'xml';
			$this->stdout->outputAs(ConsoleOutput::RAW);
		} else {
			$this->_welcome();
		}
		return $this->out($this->OptionParser->help($command, $format));
	}
开发者ID:rsuarez2012,项目名称:bioasistmr,代码行数:16,代码来源:Shell.php



注:本文中的ConsoleOptionParser类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP Console_CommandLine类代码示例发布时间:2022-05-23
下一篇:
PHP ConsoleOption类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap