Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- require_once __DIR__.'/../vendor/autoload.php';
- $parser = new Console_CommandLine([
- 'description' => 'Console_CommandLineのサンプル',
- 'version' => '0.0.1',
- ]);
- $parser->addOption('date', [
- 'short_name' => '-d',
- 'long_name' => '--date',
- 'action' => 'StoreString',
- 'help_name' => 'YYYYMMDD',
- 'description' => '対象日付',
- ]);
- $parser->addArgument('files', [
- 'multiple' => true,
- 'description' => 'ファイル名',
- ]);
- try {
- $result = $parser->parse();
- print_r($result->options);
- print_r($result->args);
- } catch (Console_CommandLine_Exception $e) {
- echo get_class($e)."\n";
- $parser->displayError($e->getMessage());
- }
Add Comment
Please, Sign In to add comment