本文整理汇总了PHP中Cake\Console\Shell::getOptionParser方法的典型用法代码示例。如果您正苦于以下问题:PHP Shell::getOptionParser方法的具体用法?PHP Shell::getOptionParser怎么用?PHP Shell::getOptionParser使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Cake\Console\Shell
的用法示例。
在下文中一共展示了Shell::getOptionParser方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getOptionParser
/**
* main() method.
*
* @return bool|int Success or error code.
*/
public function getOptionParser()
{
$parser = parent::getOptionParser();
$parser->addSubcommand('initialize', ['help' => 'Execute The Initialize-method. This will add some important data to your database.', 'parser' => $this->Initialize->getOptionParser()]);
$parser->addSubcommand('user', ['help' => 'Execute The User-task. You will be able to create an user.', 'parser' => $this->User->getOptionParser()]);
return $parser;
}
示例2: getOptionParser
/**
* Gets the option parser instance and configures it.
*
* @return \Cake\Console\ConsoleOptionParser
*/
public function getOptionParser()
{
$parser = parent::getOptionParser();
$parser->description('Asset Management for CakePHP.');
foreach ($this->_taskMap as $task => $config) {
$taskParser = $this->{$task}->getOptionParser();
$parser->addSubcommand(Inflector::underscore($task), ['help' => $taskParser->description(), 'parser' => $taskParser]);
}
return $parser;
}
示例3: getOptionParser
/**
* Gets the option parser instance and configures it.
*
* @return \Cake\Console\ConsoleOptionParser
*/
public function getOptionParser()
{
$parser = parent::getOptionParser();
$parser->addOption('config', ['default' => 'default', 'help' => 'Name of a queue config to use', 'short' => 'c']);
$parser->addOption('queue', ['help' => 'Name of queue to override from loaded config', 'short' => 'Q']);
$parser->addOption('logger', ['help' => 'Name of a configured logger', 'default' => 'stdout', 'short' => 'l']);
$parser->addOption('worker', ['choices' => ['Sequential', 'Test'], 'default' => 'Sequential', 'help' => 'Name of worker class', 'short' => 'w'])->description(__('Runs a Queuesadilla worker.'));
return $parser;
}
示例4: getOptionParser
public function getOptionParser()
{
$parser = parent::getOptionParser();
$parser->addOption('adapter', ['short' => 'a', 'help' => __('The adapter config name to use.'), 'default' => 'Local']);
$parser->addOption('model', ['short' => 'm', 'help' => __('The model / table to use.'), 'default' => 'Burzum/FileStorage.FileStorage']);
$parser->addSubcommand('image', ['help' => __('Image Processing Task.'), 'parser' => $this->Image->getOptionParser()]);
$parser->addSubcommand('store', ['help' => __('Stores a file in the DB.')]);
return $parser;
}
示例5: getOptionParser
/**
* Get option parser.
*
* @return \Cake\Console\OptionParser
*/
public function getOptionParser()
{
$parser = parent::getOptionParser();
$parser->description(__d('debug_kit', 'Allows you to obtain some rough benchmarking statistics' . 'about a fully qualified URL.'))->addArgument('url', ['help' => __d('debug_kit', 'The URL to request.'), 'required' => true])->addOption('n', ['default' => 10, 'help' => __d('debug_kit', 'Number of iterations to perform.')])->addOption('t', ['default' => 100, 'help' => __d('debug_kit', 'Maximum total time for all iterations, in seconds.' . 'If a single iteration takes more than the timeout, only one request will be made')])->epilog(__d('debug_kit', 'Example Use: `cake benchmark --n 10 --t 100 http://localhost/testsite`. ' . '<info>Note:</info> this benchmark does not include browser render times.'));
return $parser;
}
示例6: getOptionParser
/**
* Gets the option parser instance and configures it.
*
* @return \Cake\Console\ConsoleOptionParser
*/
public function getOptionParser()
{
$parser = parent::getOptionParser();
$parser->description('CakePHP Language String Extraction:')->addOption('app', ['help' => 'Directory where your application is located.'])->addOption('paths', ['help' => 'Comma separated list of paths.'])->addOption('merge', ['help' => 'Merge all domain strings into the default.po file.', 'choices' => ['yes', 'no']])->addOption('output', ['help' => 'Full path to output directory.'])->addOption('files', ['help' => 'Comma separated list of files.'])->addOption('exclude-plugins', ['boolean' => true, 'default' => true, 'help' => 'Ignores all files in plugins if this command is run inside from the same app directory.'])->addOption('plugin', ['help' => 'Extracts tokens only from the plugin specified and puts the result in the plugin\'s Locale directory.'])->addOption('ignore-model-validation', ['boolean' => true, 'default' => false, 'help' => 'Ignores validation messages in the $validate property.' . ' If this flag is not set and the command is run from the same app directory,' . ' all messages in model validation rules will be extracted as tokens.'])->addOption('validation-domain', ['help' => 'If set to a value, the localization domain to be used for model validation messages.'])->addOption('exclude', ['help' => 'Comma separated list of directories to exclude.' . ' Any path containing a path segment with the provided values will be skipped. E.g. test,vendors'])->addOption('overwrite', ['boolean' => true, 'default' => false, 'help' => 'Always overwrite existing .pot files.'])->addOption('extract-core', ['help' => 'Extract messages from the CakePHP core libs.', 'choices' => ['yes', 'no']])->addOption('no-location', ['boolean' => true, 'default' => false, 'help' => 'Do not write file locations for each extracted message.']);
return $parser;
}
示例7: getOptionParser
/**
* getOptionParser method
*
* @return $parser
*/
public function getOptionParser()
{
$parser = parent::getOptionParser();
$this->_io->styles('green_text', ['text' => 'green', 'blink' => true]);
$this->_io->styles('red_text', ['text' => 'red', 'blink' => true]);
$this->_io->styles('blue_text', ['text' => 'blue', 'blink' => true]);
$parser->addSubcommand('start_caching', ['help' => 'Cache and optimize original image in plugin webroot cache folder', 'parser' => ['description' => [__("<warning>This subcommand uses for cache and optimize all images from "), __("source folder to cache folder. Cache options gets from "), __("adaptive_image_config.php in /config dir. You also can "), __("disable image optimization if argument 'optimization' = false. "), __("If cache folder already exists - all images will be recached. </warning>")], 'arguments' => ['optimization' => ['help' => __('Enable\\Disable image optimization; boolean; <blue_text>(default: true)</blue_text>'), 'required' => false], 'src_path' => ['help' => __('Folder for source images, root is : /webroot/img/. <blue_text>(default: \'src_images\')</blue_text>'), 'required' => false]]]]);
$parser->addSubcommand('clear_cache', ['help' => 'Remove cache folder', 'parser' => ['description' => [__("<warning>Remove cache folder with cached images</warning>")]]]);
$parser->addSubcommand('check_for_img_tags', ['help' => 'Show places in code, where don\'t uses AdaptiveImgHelper for images; Search in /src dir', 'parser' => ['description' => [__("<warning>Show places in code, where don't uses AdaptiveImgHelper for images; Search in /src dir</warning>")]]]);
return $parser;
}
示例8: getOptionParser
/**
* Gets the option parser instance and configures it.
*
* @return \Cake\Console\ConsoleOptionParser
*/
public function getOptionParser()
{
$parser = parent::getOptionParser();
$infoParser = $parser->toArray();
$infoParser['arguments']['url'] = ['help' => 'Absolute URL', 'required' => false];
$parser->description('Cache Shell to cleanup caching of view files.')->addSubcommand('info', ['help' => 'Infos about the files', 'parser' => $infoParser])->addSubcommand('clear', ['help' => 'Clear all or part of the files', 'parser' => $parser]);
return $parser;
}
示例9: getOptionParser
/**
* Gets the option parser instance and configures it.
*
* @return \Cake\Console\ConsoleOptionParser
*/
public function getOptionParser()
{
$parser = parent::getOptionParser();
$parser->addOption('engine', ['choices' => ['Beanstalk', 'Iron', 'Memory', 'Mysql', 'Null', 'Redis', 'Synchronous'], 'default' => 'Mysql', 'help' => 'Name of engine', 'short' => 'e']);
$parser->addOption('queue', ['help' => 'Name of a queue', 'short' => 'q']);
$parser->addOption('logger', ['help' => 'Name of a configured logger', 'default' => 'stdout', 'short' => 'l']);
$parser->addOption('worker', ['choices' => ['Sequential', 'Test'], 'default' => 'Sequential', 'help' => 'Name of worker class', 'short' => 'w'])->description(__('Runs a Queuesadilla worker.'));
return $parser;
}
示例10: getOptionParser
/**
* Get the option parser instance and configures it.
*
* @return ConsoleOptionParser
* @see Shell::getOptionParser()
*/
public function getOptionParser()
{
$startParserArguments = ['options' => ['user' => ['short' => 'u', 'help' => __d('cake_resque', 'User running the workers')], 'queue' => ['short' => 'q', 'help' => __d('cake_resque', 'Name of the queue. If multiple queues, separe with comma.')], 'interval' => ['short' => 'i', 'help' => __d('cake_resque', 'Pause time in seconds between each works')], 'workers' => ['short' => 'n', 'help' => __d('cake_resque', 'Number of workers to fork')], 'log' => ['short' => 'l', 'help' => __d('cake_resque', 'Log path')], 'log-handler' => ['help' => __d('cake_resque', 'Log Handler to use for logging.')], 'log-handler-target' => ['help' => __d('cake_resque', 'Log Handler arguments')], 'verbose' => ['short' => 'v', 'help' => __d('cake_resque', 'Log more verbose informations'), 'boolean' => true], 'debug' => ['short' => 'd', 'help' => __d('cake_resque', 'Print debug informations'), 'boolean' => true]]];
$startSchedulerParserArguments = ['options' => ['user' => ['short' => 'u', 'help' => __d('cake_resque', 'User running the workers')], 'interval' => ['short' => 'i', 'help' => __d('cake_resque', 'Pause time in seconds between each works')], 'log' => ['short' => 'l', 'help' => __d('cake_resque', 'Log path')], 'log-handler' => ['help' => __d('cake_resque', 'Log Handler to use for logging.')], 'log-handler-target' => ['help' => __d('cake_resque', 'Log Handler arguments')], 'verbose' => ['short' => 'v', 'help' => __d('cake_resque', 'Log more verbose informations'), 'boolean' => true]]];
$stopParserArguments = ['options' => ['force' => ['short' => 'f', 'help' => __d('cake_resque', 'Force workers shutdown, forcing all the current jobs to finish (and fail)'), 'boolean' => true], 'all' => ['short' => 'a', 'help' => __d('cake_resque', 'Shutdown all workers'), 'boolean' => true]], 'description' => [__d('cake_resque', 'Stop one or all workers'), __d('cake_resque', 'Unless you force the stop with the --force option,'), __d('cake_resque', 'the worker will wait for all jobs to complete'), __d('cake_resque', 'before shutting down')]];
$pauseParserArguments = ['options' => ['all' => ['short' => 'a', 'help' => __d('cake_resque', 'Pause all workers'), 'boolean' => true], 'debug' => ['short' => 'd', 'help' => __d('cake_resque', 'Print debug informations'), 'boolean' => true]], 'description' => [__d('cake_resque', 'Pause one or all workers'), __d('cake_resque', 'Pausing is only supported on Unix system,'), __d('cake_resque', 'with PHP pcntl extension installed')]];
$resumeParserArguments = ['options' => ['all' => ['short' => 'a', 'help' => __d('cake_resque', 'Resume all paused workers'), 'boolean' => true], 'debug' => ['short' => 'd', 'help' => __d('cake_resque', 'Print debug informations'), 'boolean' => true]], 'description' => [__d('cake_resque', 'Resume one or all paused workers'), __d('cake_resque', 'Resuming is only supported on Unix system,'), __d('cake_resque', 'with PHP pcntl extension installed')]];
$cleanupParserArguments = ['options' => ['all' => ['short' => 'a', 'help' => __d('cake_resque', 'Clean up all workers'), 'boolean' => true], 'debug' => ['short' => 'd', 'help' => __d('cake_resque', 'Print debug informations'), 'boolean' => true]], 'description' => [__d('cake_resque', 'Cleaning Up one or all paused workers'), __d('cake_resque', 'Cleaning Up will immedately terminate the job'), __d('cake_resque', 'the worker is currently working on.'), __d('cake_resque', 'Resuming is only supported on Unix system,'), __d('cake_resque', 'with PHP pcntl extension installed')]];
$clearParserArguments = ['options' => ['all' => ['short' => 'a', 'help' => __d('cake_resque', 'Clear all queues'), 'boolean' => true], 'debug' => ['short' => 'd', 'help' => __d('cake_resque', 'Print debug informations'), 'boolean' => true]], 'description' => [__d('cake_resque', 'Clear one or all queues'), __d('cake_resque', 'Clearing a queue will remove all its jobs')]];
return parent::getOptionParser()->description(__d('cake_resque', "A Shell to manage PHP Resque") . "\n" . __d('cake_resque', "Version " . CakeResqueShell::VERSION) . "\n" . "Wan Chen (" . date('Y') . ")")->addSubcommand('start', ['help' => __d('cake_resque', 'Start a new worker.'), 'parser' => $startParserArguments])->addSubcommand('startscheduler', ['help' => __d('cake_resque', 'Start a new scheduler worker.'), 'parser' => $startSchedulerParserArguments])->addSubcommand('stop', ['help' => __d('cake_resque', 'Stop a worker.'), 'parser' => $stopParserArguments])->addSubcommand('pause', ['help' => __d('cake_resque', 'Pause a worker.'), 'parser' => $pauseParserArguments])->addSubcommand('resume', ['help' => __d('cake_resque', 'Resume a paused worker.'), 'parser' => $resumeParserArguments])->addSubcommand('cleanup', ['help' => __d('cake_resque', 'Immediately terminate a worker job execution.'), 'parser' => $cleanupParserArguments])->addSubcommand('restart', ['help' => __d('cake_resque', 'Stop all Resque workers, and start a new one.'), 'parser' => array_merge_recursive($startParserArguments, $stopParserArguments)])->addSubcommand('clear', ['help' => __d('cake_resque', 'Clear all jobs inside a queue'), 'parser' => $clearParserArguments])->addSubcommand('reset', ['help' => __d('cake_resque', 'Reset CakeResque internal worker\'s saved status'), 'parser' => $clearParserArguments])->addSubcommand('stats', ['help' => __d('cake_resque', 'View stats about processed/failed jobs.')])->addSubcommand('tail', ['help' => __d('cake_resque', 'Tail the workers logs.')])->addSubcommand('track', ['help' => __d('cake_resque', 'Track a job status.')])->addSubcommand('load', ['help' => __d('cake_resque', 'Load a set of predefined workers.')])->addSubcommand('enqueue', ['help' => __d('cake_resque', 'Enqueue a job.')]);
}
示例11: getOptionParser
public function getOptionParser()
{
$parser = parent::getOptionParser();
$parser->addOption('limit', ['short' => 'l', 'help' => 'how many queue records to process at once', 'default' => 20])->addOption('status', ['short' => 's', 'help' => 'only queue entities in this status will be processed', 'default' => 'pending', 'choices' => ['pending', 'failed', 'sent']])->addOption('id', ['help' => 'supply an ID to send a specific email']);
# build a list of possible types from the config file
$types = array_keys(Configure::read('EmailQueue.specific')) ?: [];
$parser->addOption('type', ['short' => 't', 'help' => 'only queue entities of this type will be processed', 'choices' => $types]);
return $parser;
}
示例12: getOptionParser
public function getOptionParser()
{
$parser = parent::getOptionParser();
return $parser;
}
示例13: getOptionParser
/**
* Gets the option parser instance and configures it.
*
* @return \Cake\Console\ConsoleOptionParser
*/
public function getOptionParser()
{
$parser = parent::getOptionParser();
$parser->description(__d('eav', 'Select target table'))->addOption('use', ['short' => 'u', 'help' => __d('eav', 'The table alias name. e.g. "User.Users".')])->addOption('bundle', ['short' => 'b', 'help' => __d('eav', 'Indicates the column belongs to a bundle name within the table.'), 'default' => null]);
return $parser;
}
示例14: getOptionParser
/**
* @inheritDoc
*/
public function getOptionParser()
{
$parser = parent::getOptionParser();
$parser->description([__d('file_storage', 'Shell command for generating and removing image versions.')]);
$parser->addOption('storageTable', ['short' => 's', 'help' => __d('file_storage', 'The storage table for image processing you want to use.')]);
$parser->addOption('limit', ['short' => 'l', 'help' => __d('file_storage', 'Limits the amount of records to be processed in one batch')]);
$parser->addSubcommands(['generate' => ['help' => __d('file_storage', '<model> <version> Generate a new image version'), 'parser' => ['arguments' => ['model' => ['help' => __d('file_storage', 'Value of the model property of the images to generate'), 'required' => true], 'version' => ['help' => __d('file_storage', 'Image version to generate'), 'required' => true]], 'options' => ['storageTable' => ['short' => 's', 'help' => __d('file_storage', 'The storage table for image processing you want to use.')], 'limit' => ['short' => 'l', 'help' => __d('file_storage', 'Limits the amount of records to be processed in one batch')], 'keep-old-versions' => ['short' => 'k', 'help' => __d('file_storage', 'Use this switch if you do not want to overwrite existing versions.'), 'boolean' => true]]]], 'remove' => ['help' => __d('file_storage', '<model> <version> Remove an new image version'), 'parser' => ['arguments' => ['model' => ['help' => __d('file_storage', 'Value of the model property of the images to remove'), 'required' => true], 'version' => ['help' => __d('file_storage', 'Image version to remove'), 'required' => true]], 'options' => ['storageTable' => ['short' => 's', 'help' => __d('file_storage', 'The storage table for image processing you want to use.')], 'limit' => ['short' => 'l', 'help' => __d('file_storage', 'Limits the amount of records to be processed in one batch')]]]], 'regenerate' => ['help' => __d('file_storage', '<model> Generates all image versions.'), 'parser' => ['arguments' => ['model' => ['help' => __d('file_storage', 'Value of the model property of the images to generate'), 'required' => true]], 'options' => ['storageTable' => ['short' => 's', 'help' => __d('file_storage', 'The storage table for image processing you want to use.')], 'limit' => ['short' => 'l', 'help' => __d('file_storage', 'Limits the amount of records to be processed in one batch')], 'keep-old-versions' => ['short' => 'k', 'help' => __d('file_storage', 'Use this switch if you do not want to overwrite existing versions.'), 'boolean' => true]]]]]);
return $parser;
}
示例15: getOptionParser
/**
* Gets the option parser instance and configures it.
*
* @return \Cake\Console\ConsoleOptionParser
*/
public function getOptionParser()
{
$parser = parent::getOptionParser();
$parser->description(__d('system', 'Export database'))->addOption('destination', ['short' => 'd', 'help' => __d('system', 'Where to place the exported tables.'), 'default' => normalizePath(TMP . '/fixture/')])->addOption('tables', ['short' => 't', 'help' => __d('system', 'Optional, comma-separated list of table names to export. All tables will be exported if not provided.'), 'default' => []])->addOption('no-id', ['short' => 'n', 'help' => __d('system', 'Exclude "id" columns from records, useful for some DB driver such as Postgres.'), 'boolean' => true, 'default' => false])->addOption('fixture', ['short' => 'f', 'help' => __d('system', 'Generates Fixture classes suitable for testing environments.'), 'boolean' => true, 'default' => false])->addOption('mode', ['short' => 'm', 'help' => __d('system', 'What to export, "full" exports schema and records, or "schema" for schema only.'), 'default' => 'full', 'choices' => ['full', 'schema']])->addOption('no-data', ['short' => 'n', 'help' => __d('system', 'List of table for which do not export data (only schema).'), 'default' => []]);
return $parser;
}