aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/cmd/edit.rb
diff options
context:
space:
mode:
authorAdam Vandenberg2011-12-16 14:27:58 -0800
committerAdam Vandenberg2011-12-16 14:27:58 -0800
commit2b297bc03f1ba8faf3af9b1cb96d2371d99d2a3c (patch)
tree291ccaa8614641d643e51a3f2450af3d4973e9c5 /Library/Homebrew/cmd/edit.rb
parent76ec8e18cfadf81c53a4239c76b1443867cde63e (diff)
downloadhomebrew-2b297bc03f1ba8faf3af9b1cb96d2371d99d2a3c.tar.bz2
Enable 'brew edit' for non-Textmate editors.
Diffstat (limited to 'Library/Homebrew/cmd/edit.rb')
-rw-r--r--Library/Homebrew/cmd/edit.rb18
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|