Class: Geet::Commandline::Editor

Inherits:
Object
  • Object
show all
Extended by:
T::Sig
Includes:
Helpers::OsHelper
Defined in:
lib/geet/commandline/editor.rb

Constant Summary collapse

HELP_SEPARATOR =

Git style!

"------------------------ >8 ------------------------"

Instance Method Summary collapse

Methods included from Helpers::OsHelper

#execute_command, #open_file_with_default_application

Instance Method Details

#edit_content(content: "", help: nil) ⇒ Object



22
23
24
25
26
27
28
29
30
# File 'lib/geet/commandline/editor.rb', line 22

def edit_content(content: "", help: nil)
  content += "\n\n" + HELP_SEPARATOR + "\n" + help if help

  edited_content = edit_content_in_default_editor(content)

  edited_content = edited_content.split(HELP_SEPARATOR, 2).first if help

  T.must(edited_content).strip
end