/** * Register options and arguments on the given $options object * * @param Options $options * @return void */ protected function setup(Options $options) { $options->setHelp('This is a simple example, not using any subcommands'); $options->registerOption('longflag', 'A flag that can also be set with a short option', 'l'); $options->registerOption('file', 'This option expects an argument.', 'f', 'filename'); $options->registerArgument('argument', 'Arguments can be required or optional. This one is optional', false); }
/** * Register options and arguments on the given $options object * * @param Options $options * @return void */ protected function setup(Options $options) { $options->setHelp('This example sets up additional subcommands using their own options'); $options->registerOption('longflag', 'This is a global flag that applies to all subcommands', 'l'); $options->registerCommand('foo', 'The foo command'); $options->registerCommand('bar', 'The bar command'); $options->registerOption('someflag', 'This is a flag only valid for the foo command', 's', false, 'foo'); $options->registerArgument('file', 'This argument is only required for the foo command', true, 'foo'); $options->registerOption('load', 'Another flag only for the bar command, requiring an argument', 'l', 'input', 'bar'); }