0;"); } /** * Add help components to a command. */ function hook_drush_help_alter(&$command) { if ($command['command'] == 'sql-sync') { $command['options']['myoption'] = "Description of modification of sql-sync done by hook"; $command['sub-options']['sanitize']['my-sanitize-option'] = "Description of sanitization option added by hook (grouped with --sanitize option)"; } if ($command['command'] == 'global-options') { // Recommended: don't show global hook options in brief global options help. if ($command['#brief'] === FALSE) { $command['options']['myglobaloption'] = 'Description of option used globally in all commands (e.g. in a commandfile init hook)'; } } } /** * Add/edit options to cache-clear command. * * @param array $types * Adjust types as needed. Is passed by reference. * * @param bool $include_bootstrapped_types * If FALSE, omit types which require a FULL bootstrap. */ function hook_drush_cache_clear(&$types, $include_bootstrapped_types) { $types['views'] = 'views_invalidate_cache'; } /** * Inform drush about one or more engine types. * * This hook allow to declare available engine types, the cli option to select * between engine implementatins, which one to use by default, global options * and other parameters. Commands may override this info when declaring the * engines they use. * * @return array * An array whose keys are engine type names and whose values describe * the characteristics of the engine type in relation to command definitions: * * - description: The engine type description. * - topic: If specified, the name of the topic command that will * display the automatically generated topic for this engine. * - topic-file: If specified, the path to the file that will be * displayed at the head of the automatically generated topic for * this engine. This path is relative to the Drush root directory; * non-core commandfiles should therefore use: * 'topic-file' => dirname(__FILE__) . '/mytopic.html'; * - topics: If set, contains a list of topics that should be added to * the "Topics" section of any command that uses this engine. Note * that if 'topic' is set, it will automatically be added to the topics * list, and therefore does not need to also be listed here. * - option: The command line option to choose an implementation for * this engine type. * FALSE means there's no option. That is, the engine type is for internal * usage of the command and thus an implementation is not selectable. * - default: The default implementation to use by the engine type. * - options: Engine options common to all implementations. * - add-options-to-command: If there's a single implementation for this * engine type, add its options as command level options. * - combine-help: If there are multiple implementations for this engine * type, then instead of adding multiple help items in the form of * --engine-option=engine-type [description], instead combine all help * options into a single --engine-option that lists the different possible * values that can be used. * * @see drush_get_engine_types_info() * @see pm_drush_engine_type_info() */ function hook_drush_engine_type_info() { return array( 'dessert' => array( 'description' => 'Choose a dessert while the sandwich is baked.', 'option' => 'dessert', 'default' => 'ice-cream', 'options' => 'sweetness', 'add-options-to-command' => FALSE, ), ); } /** * Inform drush about one or more engines implementing a given engine type. * * - description: The engine implementation's description. * - implemented-by: The engine that actually implements this engine. * This is useful to allow the implementation of similar engines * in the reference one. * Defaults to the engine type key (e.g. 'ice-cream'). * - verbose-only: The engine implementation will only appear in help * output in --verbose mode. * * This hook allow to declare implementations for an engine type. * * @see pm_drush_engine_package_handler() * @see pm_drush_engine_version_control() */ function hook_drush_engine_ENGINE_TYPE() { return array( 'ice-cream' => array( 'description' => 'Feature rich ice-cream with all kind of additives.', 'options' => array( 'flavour' => 'Choose your favorite flavour', ), ), 'frozen-yogurt' => array( 'description' => 'Frozen dairy dessert made with yogurt instead of milk and cream.', 'implemented-by' => 'ice-cream', ), ); } /** * Alter the order that hooks are invoked. * * When implementing a given hook we may need to ensure it is invoked before * or after another implementation of the same hook. For example, let's say * you want to implement a hook that would be called after drush_make. You'd * write a drush_MY_MODULE_post_make() function. But if you need your hook to * be called before drush_make_post_make(), you can ensure this by implemen- * ting MY_MODULE_drush_invoke_alter(). * * @see drush_command_invoke_all_ref() */ function hook_drush_invoke_alter($modules, $hook) { if ($hook == 'some_hook') { // Take the module who's hooks would normally be called last. $module = array_pop($modules); // Ensure it'll be called first for 'some_hook'. array_unshift($modules, $module); } } /* * Storage filters alter the .yml files on disk after a config-export or before * a config-import. See `drush topic docs-config-filter` and config_drush_storage_filters(). */ function hook_drush_storage_filters() { $result = array(); $module_adjustments = drush_get_option('skip-modules'); if (!empty($module_adjustments)) { if (is_string($module_adjustments)) { $module_adjustments = explode(',', $module_adjustments); } $result[] = new CoreExtensionFilter($module_adjustments); } return $result; } /** * @} End of "addtogroup hooks". */