Module: Utils::Editor Private
- Defined in:
- utils/editor.rb
This module is part of a private API. This module may only be used in the Homebrew/brew repository. Third parties should avoid using this module if possible, as it may be removed or changed without warning.
Class Method Summary collapse
- .command(silent: false) ⇒ String private
- .open(*filenames) ⇒ void private
Class Method Details
.command(silent: false) ⇒ String
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'utils/editor.rb', line 13 def command(silent: false) editor = Homebrew::EnvConfig.editor return editor if editor editor = %w[code codium cursor code-insiders subl mate bbedit vim].find do |candidate| candidate if Utils::Shell.which(candidate, ORIGINAL_PATHS) end editor ||= "vim" unless silent Utils::Output.opoo <<~EOS Using #{editor} because no editor was set in the environment. This may change in the future, so we recommend setting `$EDITOR` or `$HOMEBREW_EDITOR` to your preferred text editor. EOS end editor end |
.open(*filenames) ⇒ void
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
This method returns an undefined value.
34 35 36 37 |
# File 'utils/editor.rb', line 34 def open(*filenames) $stdout.puts "Editing #{filenames.join "\n"}" Utils::Shell.with_homebrew_path { SystemCommand.safe_system(*command.shellsplit, *filenames) } end |