Handy Drupal command-line shortcuts

published on July 29, 2007

Add these lines to your ~/.bash_profile if you’re using the Bash shell:

alias ddiff="cvs diff -u -F^f -N > "
alias dhead="cvs -z6 -d:pserver:anonymous:anonymous@cvs.drupal.org:/cvs/drupal checkout drupal"
alias dupdate="cvs update -dP"

Now you have three new commands at your disposal:

ddiff
Usage: ddiff patchfile.patch, creates a patch file.
dhead
Usage: dhead, checks out Drupal HEAD in the current directory.
dupdate
Usage: dupdate, updates the current directory recursively.

Update on August 10, 2011

While cleaning up my ~/.bash_profile file, I came across the following functions that I’ve used for many years and shared with several other Drupal developers. These are now obsolete, thanks to Drupal.org’s migration from CVS to git.

function drupal {
  if [ $# -eq "2" ]
  then
    cvs -z6 -d:pserver:anonymous:anonymous@cvs.drupal.org:/cvs/drupal checkout -d $1 -r DRUPAL-$2 drupal
  else
    cvs -z6 -d:pserver:anonymous:anonymous@cvs.drupal.org:/cvs/drupal checkout -d $1 drupal
  fi
}

function drupal_module {
  if [ $# -eq "2" ]
  then
    cvs checkout -d $1 -r DRUPAL-$2 contributions/modules/$1
  else
    cvs checkout -d $1 contributions/modules/$1
  fi
}

function drupal_theme {
  if [ $# -eq "2" ]
  then
    cvs checkout -d $1 -r DRUPAL-$2 contributions/themes/$1
  else
    cvs checkout -d $1 contributions/themes/$1
  fi
}

function drupal_revs() {
  cvs log "${1}" | egrep 'DRUPAL-.*:' | sort
}

Comments

Anonymous's picture

Anonymous

Thanks ;) Keep’em coming man!