Module: Gitdig::Commands::Mixin::Editorable
- Included in:
- Pr
- Defined in:
- lib/gitdig/commands/mixin/editorable.rb
Constant Summary collapse
- OUTPUT_FILE =
File.('.gitdig_output.md', Dir.home)
Instance Method Summary collapse
Instance Method Details
#editor_exec(command) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/gitdig/commands/mixin/editorable.rb', line 9 def editor_exec(command) if [:editor] out = StringIO.new command.execute(output: out) opts = { content: out.string } opts[:command] = [:editor] if [:editor] != 'true' open_editor(command, opts) else command.execute end end |
#open_editor(command, opts) ⇒ Object
21 22 23 24 |
# 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 |