module Gitdig::Commands::Mixin::Editorable

Constants

OUTPUT_FILE

Public Instance Methods

editor_exec(command) click to toggle source
# File lib/gitdig/commands/mixin/editorable.rb, line 9
def editor_exec(command)
  if options[:editor]
    out = StringIO.new
    command.execute(output: out)
    opts = { content: out.string }
    opts[:command] = options[:editor] if options[:editor] != 'true'
    open_editor(command, opts)
  else
    command.execute
  end
end
open_editor(command, opts) click to toggle source
# File lib/gitdig/commands/mixin/editorable.rb, line 21
def open_editor(command, opts)
  command.generator.remove_file OUTPUT_FILE, verbose: false
  command.editor.open(OUTPUT_FILE, opts)
end