メインコンテンツに移動

shirane lab

メインナビゲーション

  • ホーム
  • ブログ
  • Drush
  • 検索

パンくず

  • ホーム
  • ブログ
  • Drush のコマンド ヘルプについて

Drush のコマンド ヘルプについて

2020/12/24(木) - 00:00
shirane

この記事は、Drupal アドベントカレンダー 2020 の 24 日目です。


Drupal の開発/運用を効率的に行う上で、Composer、Drush、Drupal Console といった CLI(コマンドライン インターフェイス)ツールは重要です。中でも、Drush は古くから使われてきた Drupal 固有の CLI ツールで、Drupal の実務に欠かせません。

Drush には数多くの機能が標準で用意されており、引数なしで drush コマンドを実行すると、すべての機能(サブコマンド)が短い説明とともに表示されます。また、特定のサブコマンドの後に --help オプションを指定して実行することで、そのサブコマンドのヘルプを閲覧できます。

$ drush cr --help
Rebuild a Drupal 8 site.

This is a copy of core/rebuild.php. Additionally
 it also clears Drush cache and Drupal's render cache.

Options:
  --cache-clear[=CACHE-CLEAR] Set to 0 to suppress normal cache clearing;
                              the caller should then clear if needed.
                              [default: true]
  --no-cache-clear            Negate --cache-clear option.

Aliases: cr, rebuild, cache-rebuild

また「drush topic」と実行すると、さらに踏み込んだ内容のドキュメントを参照できます。

$ drush topic

 Choose a topic:
  [0 ] Cancel
  [1 ] All global options. (core:global-options)
  [2 ] An example Drush script. (docs:script)
  [3 ] Bashrc customization examples for Drush. (docs:bashrc)
  [4 ] Bootstrap explanation: how Drush starts up and prepares the Drupal environment. (docs:bootstrap)
  [5 ] Creating site aliases for running Drush on remote sites. (docs:aliases)
  [6 ] Crontab instructions for running your Drupal cron tasks via `drush cron`. (docs:cron)
  [7 ] Deploy command for Drupal. (docs:deploy)
  [8 ] Drupal config export instructions, including customizing config by environment. (docs:config:exporting)
  [9 ] Drush's PHP Shell. (docs:repl)
  [10] Drush's support for Git Bisect. (docs:bisect)
  [11] Drush configuration example. (docs:configuration)
  [12] Drush hooks. (docs:hooks)
  [13] Example Drush command file. (docs:examplecommand)
  [14] Example policy file. (docs:policy)
  [15] Extend sql-sync to allow transfer of the sql dump file via http. (docs:example-sync-via-http)
  [16] Instructions on creating your own Drush commands. (docs:commands)
  [17] Instructions on creating your own Drush Generators. (docs:generators)
  [18] Output formatters and filters: control the command output (docs:output-formats-filters)
  [19] README.md (docs:readme)
 >

これらの資料は、drush.org で Web ドキュメントとして読むこともできます。使い慣れたツールでも、一度こうした資料を網羅的に見ておくと新しい発見があるかもしれません。

すべて英語というところが難点なので、自分も勉強のため Drush のコマンドヘルプを1件ずつ読んで日本語化し、ブログ記事としてアップしてきました。この年末までに一通り網羅できたので、コマンドの分類で記事を絞り込めるようにしてみました。今後、Drush コマンドの日本語リファレンスとして活用していければと思います。間違いやコメントなどあれば、@bkenro までお知らせいただけると嬉しいです。


ところで、Drush の使い方については、コミュニティ有志による電子書籍『Drupal 9 Web 開発をはじめるための薄い本』(Drupal Meetup 豊田支部=編)でも独立した章をあてて解説されています。

Drupal 9 Web 開発をはじめるための薄い本

"薄い本" と銘打ちながらも、最新 Drupal 9 に関する内容満載!ボリューム満点の一冊です。是非ぜひチェックしてみてください。

Drush
コミュニティ
‹ 前の記事次の記事 ›

書籍

『D9 おいしいレシピ集2』がパワーアップして商業誌に

『D9 おいしいレシピ集2』がパワーアップして商業誌に

 書籍の一覧はこちら

 

タグ一覧

DrushDrupal9Drupal6ffdsmVagrant開発環境VirtualBoxDrupal7ComposerコミュニティDrupal5Migrate勉強会モジュールDocker書籍ubercartWindowsCKEditorArtisteerDrupal ONSENDrupal4MariaDBTwigデバッグthemingTomeテーマH5PインストールAnalytics仮想マシンCentOSMacREPLpsyshDruxtJSデカップルドヘッドレスNuxtQuizVue

サイト運営

シナジークエスト

© shirane lab