Going directly to a module's project page from the command line

Seems like I spend at least 20 minutes everyday typing out URLs to drupal.org project pages. With 6,750+ modules (and counting...), I often have to assess a new module I come across or refresh myself on the details of a certain module in use. Wouldn't it be nice to have a little hack to make this quicker? I'm usually on the command line when needing this info, so why not a command line hack?

I'm using Google Chrome, so I did the below using the google-chrome command, but if you wanted it would work just as well using a firefox command. I tried an alias first, but you can't pass input to an alias (at least from the Bash shell). Ok, so first we create a shell script with a new unused name for our command, you can do this anywhere, but if you want it to be in your path without needing to add it, then put it in /usr/bin/. I like using "dp" as the name of the command, but you could make it whatever you want (e.g, dp for drupal-project or drupal or whatever).

  1. vim /usr/bin/dp (*Note: You can use any text editor, such as gedit, I just usually use vim)
  2. Enter the text: google-chrome http://drupal.org/project/$1;
  3. chmod +x /usr/bin/dp
  4. chmod 755 /usr/bin/dp
    1. That's it! Now from the command line you can try it out:

      dp savetoftp

      Voila. A fresh new tab taking me straight to the project page of the SaveToFTP module (that's my module by the way).

      Have fun with the command line

Comments

command line access

Thanks for this ingenious idea. I had to rename mine to "dp". When I used "dr" it was misinterpreted as a drush command and it didn't know what to do.

Good call. I updated my

Good call. I updated my instructions to use dp instead as it is quite common to have dr set as the drush alias. Thanks.

Search, too

I have a similar shortcut setup in Alfred (http://www.alfredapp.com/), and there's a second one that has been even more helpful: searching modules. Sometimes I know the name of the module I need to look at (views, cck, simplenews, etc), but more often than that, I'm looking for a new-to-me module to solve a new problem.

The search text for that:

http://drupal.org/project/modules?text=$1

I've also got one to search the API:

http://api.drupal.org/api/search/6/$1

That one is especially handy because if you search for an exact function name (like hook_nodeapi) it will redirect to the page for that function.

Awesome suggestion. I blogged

Awesome suggestion. I blogged about something similar here last year: http://www.coderintherye.com/node/31

Add new comment

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.

Comment using an existing account (Google, Twitter, etc.)