10
Nov
Nov
Drush is a shell interface for managing Drupal right from your server command line. It is a very useful tool as it helps you perform various admin tasks using just one or two commands in the terminal, replacing the need for many clicks and page refreshes in the UI. It comes by default with a bunch of useful commands, such as downloading, enabling or even updating modules.
First of all you need to create a new custom module for building the command.
The module should contain the following files:
- new_module.drush.inc
- new_module.module
- new_module.info
The new_module module functionality we want to expose to Drush, it’s a function that sets the

There are 2 main components in the Drush command architecture: the hook implementation where we define the commands and their configurations, and the callback functions that get triggered by the command.
First, let’s implement hook_drush_command() and define a simple command called

The second part of the Drush command architecture is the callback function. As it is now, Drush expects a function to be declared called

Now if you clear the drush cache drush cc all, you can run the "drush ddc" command and you should see
First of all you need to create a new custom module for building the command.
The module should contain the following files:
- new_module.drush.inc
- new_module.module
- new_module.info
The new_module module functionality we want to expose to Drush, it’s a function that sets the
Hello world!
message:
There are 2 main components in the Drush command architecture: the hook implementation where we define the commands and their configurations, and the callback functions that get triggered by the command.
First, let’s implement hook_drush_command() and define a simple command called
drush-demo-command
with an alias of ddc
:
The second part of the Drush command architecture is the callback function. As it is now, Drush expects a function to be declared called
drush_drush_demo_command()
This default naming structure starts with drush
followed by the name of the command all connected with underscores. So let’s quickly declare it and use it to call the demo_drush_print_statement()
function we wrote earlier:
Now if you clear the drush cache drush cc all, you can run the "drush ddc" command and you should see
Hello world!
printed to the screen. Now the new command should work.Category View
Tags
activities
Aggregation
amazon
android
apache
API
appcelerator
application
assistant manager
backup
balance
brand recognition
business days
cache
camp
coding standards
command
commerce
community
context
cURL
customer engagement
customer portal
database
data integrity
deployment
developer
Drupal
drupal 7
drupal 8
Drupal Camp
Drupal Core
Drupal development
Drupal solution
Drush
e-commerce
events
filter
front-end developer
game
games
general
git
Global Training
google maps
integration
ios
job
Job fairs
jobs
kpi
maintenance
manual testing
memcache
mobile
mobile app
mobile application
mobile development
Module
modules
mysql
open source
Panels
performance
php
php developer
plans
project
project manager
promotion
qa
Quality Assurance
redis
registry
Relation
release candidate
remote team
responsibilities
responsive
screen resolutions
Scrum
Security
server
Services
session
skills
software
software testing
sprint
stock management system
studio
support
Targul de Cariere
team
team building
teambuilding
teamwork
testing
titanium
tutorial
Târgul de Cariere in IT
Unit Testing
update
Updates
usability
user experience
varnish
Views
Views Handler
web application
web application testing
web development
webservice
webshop
website usability