I’ve been using grails to prototype a crud application today and I thought I’d share some annoyances that I had in getting my terminal just the way that I like it. Firstly I should say that I’m using Zsh with oh-my-ssh which gives you lots of nice things on top of the shell.
Get command completion for grails
oh-my-zsh comes with some nifty plugins, one of which will allow give you grails command completion on the terminal. All you need to do is to open your zsh configuration file…
…and then add grails to the list of active plugins
# Which plugins would you like to load? (plugins can be found in ~/.oh-my-zsh/plugins/*) # Custom plugins may be added to ~/.oh-my-zsh/custom/plugins/ # Example format: plugins=(rails git textmate ruby lighthouse) plugins=(git osx grails)
You can then close and reopen the terminal, or re-read the configuration…
No, I really don’t mean ‘rails’
The next annoyance is that zsh can take some time to learn that your newly installed ‘grails’ command actually exists. Until that happens you’ll get something like this (assuming you have correction enabled globally)
zsh: correct 'grails' to 'rails' [nyae]?
The options it is giving you here are pretty straightforward:
- n for “no“. This will run the command you entered (“grails”)
- y for “yes“. This will run the command zsh suggested (“rails”)
- a for “abort“. This will abort the command and return you to an empty terminal prompt
- e for “edit“. This will return you to a terminal prompt with “grails” still typed, should you wish to correct it manually.
There are a couple of ways to get zsh to realise that “grails” is valid though. The first is to tell it to update its hash of legal commands:
If you don’t want to do that or if it doesn’t work you can also alias the command and prepend “nocorrect”. Open up your zsh configuration file again…
…and add this line
alias grails='nocorrect grails'
Finally reload the configuration file again.