diff options
| author | Adam Vandenberg | 2011-12-16 14:27:58 -0800 |
|---|---|---|
| committer | Adam Vandenberg | 2011-12-16 14:27:58 -0800 |
| commit | 62e1dd8bd5f227bc3d56cf253d5bdc88aefb2496 (patch) | |
| tree | 0b56db12dba094e62c633db4765d3e7889f23986 /Library/Homebrew/cmd/edit.rb | |
| parent | df8edc94d6237cc58e8eb51d537c7ddb18687e98 (diff) | |
| download | brew-62e1dd8bd5f227bc3d56cf253d5bdc88aefb2496.tar.bz2 | |
Enable 'brew edit' for non-Textmate editors.
Diffstat (limited to 'Library/Homebrew/cmd/edit.rb')
| -rw-r--r-- | Library/Homebrew/cmd/edit.rb | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/Library/Homebrew/cmd/edit.rb b/Library/Homebrew/cmd/edit.rb index 252892caa..a2f5082b5 100644 --- a/Library/Homebrew/cmd/edit.rb +++ b/Library/Homebrew/cmd/edit.rb @@ -2,14 +2,18 @@ require 'formula' module Homebrew extend self def edit + # If no brews are listed, open the project root in an editor. if ARGV.named.empty? - # EDITOR isn't a good fit here, we need a GUI client that actually has - # a UI for projects, so apologies if this wasn't what you expected, - # please improve it! :) - exec 'mate', HOMEBREW_REPOSITORY+"bin/brew", - HOMEBREW_REPOSITORY+'README.md', - HOMEBREW_REPOSITORY+".gitignore", - *library_folders + editor = which_editor + if editor == "mate" + # If the user is using TextMate, give a nice project view instead. + exec 'mate', HOMEBREW_REPOSITORY+"bin/brew", + HOMEBREW_REPOSITORY+'README.md', + HOMEBREW_REPOSITORY+".gitignore", + *library_folders + else + exec_editor HOMEBREW_REPOSITORY + end else # Don't use ARGV.formulae as that will throw if the file doesn't parse paths = ARGV.named.map do |name| |
