mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 11:28:25 +00:00
Adding ConsoleOptionParser and its test.
This commit is contained in:
parent
41db1485aa
commit
d914c0aaea
2 changed files with 77 additions and 0 deletions
52
cake/console/console_option_parser.php
Normal file
52
cake/console/console_option_parser.php
Normal file
|
@ -0,0 +1,52 @@
|
|||
<?php
|
||||
/**
|
||||
* ConsoleOptionParser file
|
||||
*
|
||||
* PHP 5
|
||||
*
|
||||
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
|
||||
* Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
*
|
||||
* Licensed under The MIT License
|
||||
* Redistributions of files must retain the above copyright notice.
|
||||
*
|
||||
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
* @link http://cakephp.org CakePHP(tm) Project
|
||||
* @package cake
|
||||
* @subpackage cake.cake.console
|
||||
* @since CakePHP(tm) v 2.0
|
||||
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
||||
*/
|
||||
|
||||
/**
|
||||
* Handles parsing the ARGV in the command line and provides support
|
||||
* for GetOpt compatible option definition. Provides a builder pattern implementation
|
||||
* for creating shell option parsers.
|
||||
*
|
||||
* @package cake
|
||||
* @subpackage cake.cake.console
|
||||
*/
|
||||
class ConsoleOptionParser {
|
||||
/**
|
||||
* Construct an OptionParser for a given ARGV array.
|
||||
*
|
||||
* ### Positional arguments
|
||||
*
|
||||
* ### Switches
|
||||
*
|
||||
* Named arguments come in two forms, long and short. Long arguments are preceeded
|
||||
* by two - and give a more verbose option name. i.e. `--version`. Short arguments are
|
||||
* preceeded by one - and are only one character long. They usually match with a long option,
|
||||
* and provide a more terse alternative.
|
||||
*
|
||||
* ### Providing Help text
|
||||
*
|
||||
* By providing help text for your positional arguments and named arguments, the ConsoleOptionParser
|
||||
* can generate a help display for you. You can view the help for shells by using the `--help` or `-h` switch.
|
||||
*
|
||||
* @param array $args The array of arguments with the Shell/Task stripped off.
|
||||
*/
|
||||
public function __construct($args) {
|
||||
|
||||
}
|
||||
}
|
25
cake/tests/cases/console/console_option_parser.test.php
Normal file
25
cake/tests/cases/console/console_option_parser.test.php
Normal file
|
@ -0,0 +1,25 @@
|
|||
<?php
|
||||
/**
|
||||
* ConsoleOptionParserTest file
|
||||
*
|
||||
* PHP 5
|
||||
*
|
||||
* CakePHP(tm) Tests <http://book.cakephp.org/view/1196/Testing>
|
||||
* Copyright 2005-2010, Cake Software Foundation, Inc.
|
||||
*
|
||||
* Licensed under The MIT License
|
||||
* Redistributions of files must retain the above copyright notice
|
||||
*
|
||||
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc.
|
||||
* @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
|
||||
* @package cake
|
||||
* @subpackage cake.tests.cases.console
|
||||
* @since CakePHP(tm) v 2.0
|
||||
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
||||
*/
|
||||
|
||||
require_once CAKE . 'console' . DS . 'console_option_parser.php';
|
||||
|
||||
class ConsoleOptionParserTest extends CakeTestCase {
|
||||
|
||||
}
|
Loading…
Reference in a new issue