Class: Geet::Commandline::Editor
- Inherits:
-
Object
- Object
- Geet::Commandline::Editor
- Includes:
- Helpers::OsHelper
- Defined in:
- lib/geet/commandline/editor.rb
Constant Summary collapse
- HELP_SEPARATOR =
Git style!
'------------------------ >8 ------------------------'
Instance Method Summary collapse
-
#edit_content(content: '', help: nil) ⇒ Object
Edits a content in the default editor, optionally providing help.
Methods included from Helpers::OsHelper
#execute_command, #open_file_with_default_application
Instance Method Details
#edit_content(content: '', help: nil) ⇒ Object
Edits a content in the default editor, optionally providing help.
When the help is provided, it’s appended to the bottom, separated by HELP_SEPARATOR. The help is stripped after the content if edited.
20 21 22 23 24 25 26 27 28 |
# File 'lib/geet/commandline/editor.rb', line 20 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 edited_content.strip end |