當前位置: 首頁>>代碼示例>>PHP>>正文


PHP ConsoleOptionParser::addArgument方法代碼示例

本文整理匯總了PHP中ConsoleOptionParser::addArgument方法的典型用法代碼示例。如果您正苦於以下問題:PHP ConsoleOptionParser::addArgument方法的具體用法?PHP ConsoleOptionParser::addArgument怎麽用?PHP ConsoleOptionParser::addArgument使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在ConsoleOptionParser的用法示例。


在下文中一共展示了ConsoleOptionParser::addArgument方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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: testHelpWithLotsOfArguments

 /**
  * Test that a long set of arguments doesn't make useless output.
  *
  * @return void
  */
 public function testHelpWithLotsOfArguments()
 {
     $parser = new ConsoleOptionParser('mycommand', false);
     $parser->addArgument('test', array('help' => 'A test option.'))->addArgument('test2', array('help' => 'A test option.'))->addArgument('test3', array('help' => 'A test option.'))->addArgument('test4', array('help' => 'A test option.'))->addArgument('test5', array('help' => 'A test option.'))->addArgument('test6', array('help' => 'A test option.'))->addArgument('test7', 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->text();
     $expected = 'cake mycommand [-h] [arguments]';
     $this->assertContains($expected, $result);
 }
開發者ID:SebFav,項目名稱:ApplicationInternet2,代碼行數:14,代碼來源:HelpFormatterTest.php

示例3: testPositionalArgWithChoices

 /**
  * test that arguments with choices enforce them.
  *
  * @expectedException ConsoleException
  * @return void
  */
 public function testPositionalArgWithChoices()
 {
     $parser = new ConsoleOptionParser('test', FALSE);
     $parser->addArgument('name', array('choices' => array('mark', 'jose')))->addArgument('alias', array('choices' => array('cowboy', 'samurai')))->addArgument('weapon', array('choices' => array('gun', 'sword')));
     $result = $parser->parse(array('mark', 'samurai', 'sword'));
     $expected = array('mark', 'samurai', 'sword');
     $this->assertEquals($expected, $result[1], 'Got the correct value.');
     $parser->parse(array('jose', 'coder'));
 }
開發者ID:mrbadao,項目名稱:api-official,代碼行數:15,代碼來源:ConsoleOptionParserTest.php


注:本文中的ConsoleOptionParser::addArgument方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。