Drupal 8 Console 命令列工具

來源:互聯網
上載者:User

標籤:

轉載: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.3Usage: 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-docAvailable 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 命令列工具

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.