diff options
| author | Jack Nagel | 2015-01-05 15:23:35 -0500 |
|---|---|---|
| committer | Jack Nagel | 2015-01-05 15:23:35 -0500 |
| commit | 04f600bb503c985a7b57ecdc3a8a6c107c0b3cfa (patch) | |
| tree | 45c67dee4949e3fc0059e5d1bd494d77a649b474 /Library/Homebrew/utils.rb | |
| parent | dc16371e19d1a8bae153f6f44620667c0f542e73 (diff) | |
| download | brew-04f600bb503c985a7b57ecdc3a8a6c107c0b3cfa.tar.bz2 | |
Emit warning when no editor is set
Closes Homebrew/homebrew#34647.
Diffstat (limited to 'Library/Homebrew/utils.rb')
| -rw-r--r-- | Library/Homebrew/utils.rb | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/Library/Homebrew/utils.rb b/Library/Homebrew/utils.rb index d4d8288c6..c6e911bdf 100644 --- a/Library/Homebrew/utils.rb +++ b/Library/Homebrew/utils.rb @@ -208,17 +208,24 @@ end def which_editor editor = ENV.values_at('HOMEBREW_EDITOR', 'VISUAL', 'EDITOR').compact.first - # If an editor wasn't set, try to pick a sane default return editor unless editor.nil? # Find Textmate - return 'mate' if which "mate" + editor = "mate" if which "mate" # Find BBEdit / TextWrangler - return 'edit' if which "edit" + editor ||= "edit" if which "edit" # Find vim - return 'vim' if which "vim" + editor ||= "vim" if which "vim" # Default to standard vim - return '/usr/bin/vim' + editor ||= "/usr/bin/vim" + + opoo <<-EOS.undent + Using #{editor} because no editor was set in the environment. + This may change in the future, so we recommend setting EDITOR, VISUAL, + or HOMEBREW_EDITOR to your preferred text editor. + EOS + + editor end def exec_editor *args |
