码迷,mamicode.com
首页 > 其他好文 > 详细

Drupal 8 Console 命令行工具

时间:2015-11-19 22:23:13      阅读:374      评论:0      收藏:0      [点我收藏+]

标签:

转载:https://yplam.com/post/79

Drupal Console 是面向Drupal 8 的一套命令行工具,用来生成Drupal 8模板代码,并且可以跟Drupal 8应用进行交互。

Drupal Console 与大家熟知的Drush有点类似,但提供不一样的功能,它可以跟Drush结合使用。

安装


$ curl -LSs http://drupalconsole.com/installer | php
windows下:
php -r "readfile(‘http://drupalconsole.com/installer‘);" | php

当然,你也可以将它移到系统的PATH路径,然后更名为drupal命令


$ mv console.phar /usr/local/bin/drupal

去到一个Drupal的安装目录里,运行

drupal list

它会列出当前可用的命令及简介。如果你以前使用过Symfony的话,会感觉很熟悉。


Drupal Console version 0.9.3 Usage: command [options] [arguments] Options: -h, --help Display this help message -q, --quiet Do not output any message -V, --version Display this application version --ansi Force ANSI output --no-ansi Disable ANSI output -n, --no-interaction Do not ask any interactive question --root[=ROOT] application.console.arguments.root -s, --shell Launch the shell. -e, --env[=ENV] The Environment name. [default: "prod"] --no-debug Switches off debug mode. --learning Generate a verbose code output. -t, --target[=TARGET] application.console.arguments.target -v|vv|vvv, --verbose Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug -gc, --generate-chain Print execution options and arguments as yaml output to be used in chain command -gi, --generate-inline Print execution options and arguments as inline call to be use in the future -gd, --generate-doc application.console.arguments.generate-doc Available commands: _completion BASH completion hook. about Display basic information about Drupal Console project chain Chain command execution complete commands.complete.description drush Run drush from console. help Displays help for a command init Copy configuration files to user home directory. list Lists commands self-update Update the console to latest version. cache cache:rebuild Rebuild and clear all site caches. config config:debug Show the current configuration. config:edit Edit the selected configuration. config:export Export current application configuration. config:export:content:type Export a specific content type and their fields. config:export:single Export single configuration as yml file. config:export:view Export a view in YAML format inside a provided module to reuse in other website. config:import Import configuration to current application. config:import:single Import the selected configuration. config:override Override config value in active configuration. container container:debug Displays current services for an application. cron cron:debug List of modules implementing a cron cron:execute Execute cron implementations by module or execute all crons cron:release Release cron system lock to run cron again dblog dblog:clear Remove events from DBLog table, filters are available dblog:debug Display current log events for the application generate generate:authentication:provider Generate an Authentication Provider generate:command Generate commands for the console. generate:controller Generate & Register a controller generate:doc commands.generate.doc.description generate:entity:bundle Generate a new content type (node / entity bundle) generate:entity:config commands.generate.entity.description generate:entity:content commands.generate.entity.description generate:event:subscriber Generate an event subscriber generate:form:alter Generate an implementation of hook_form_alter() or hook_form_FORM_ID_alter generate:form:config Generate a new "ConfigFormBase" generate:module Generate a module. generate:permissions Generate module permissions generate:plugin:block Generate a plugin block generate:plugin:condition Generate a plugin condition. generate:plugin:field Generate field type, widget and formatter plugins. generate:plugin:fieldformatter Generate field formatter plugin. generate:plugin:fieldtype Generate field type plugin. generate:plugin:fieldwidget Generate field widget plugin. generate:plugin:imageeffect Generate image effect plugin. generate:plugin:imageformatter Generate image formatter plugin. generate:plugin:rest:resource Generate plugin rest resource generate:plugin:rulesaction Generate a plugin rule action generate:plugin:type:annotation Generate a plugin type with annotation discovery generate:plugin:type:yaml Generate a plugin type with Yaml discovery generate:plugin:views:field Generate a custom plugin view field. generate:service Generate service generate:theme Generate a theme. migrate migrate:debug Display current migration available for the application migrate:execute Execute a migration available for application migrate:load Generate a migration entity. module module:debug Display current modules available for application module:download Install module or modules in the application module:install Install module or modules in the application module:uninstall Install module or modules in the application rest rest:debug Display current rest resource for the application rest:disable Disable a rest resource for the application rest:enable Enable a rest resource for the application router router:debug Displays current routes for the application router:rebuild Rebuild routes for the application site site:debug List all known local and remote sites. site:install Install a Drupal project site:maintenance Switch site into maintenance mode site:mode Switch system performance configuration site:new Create a new Drupal project site:status View current Drupal Installation status test test:debug List Test Units available for the application. test:run Run Test unit from tests available for application update update:debug Display current updates available for the application update:execute Display current updates available for the application user user:login:clear:attempts Clear login failed attempts for an account. user:login:url Returns a one time user login url. user:password:hash Generate a hash from a plaintext password. user:password:reset Reset password for a specific user. views views:debug Display current views resources for the application views:disable Disable a View views:enable Enable a View yaml yaml:diff Compare two YAML files do determined differences between them yaml:merge Merge one or more YAML files in a new YAML file. Latest values are preserved. yaml:split Split a YAML file using indent as separator criteria yaml:update:key Replace a YAML key in a YAML file. yaml:update:value Update a value for a specific key in a YAML file.

其中,个人认为比较常用的应该是 generate:: 下面的一堆命令了,特别是因为 Drupal 8 下面添加Entity等需要进行的工作是在是多,这些命令可以大大减轻重复劳动。

Drupal 8 Console 命令行工具

标签:

原文地址:http://www.cnblogs.com/mafeifan/p/4979175.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!