Method: Snip::Command::Edit#execute

Defined in:
lib/snip/command/edit.rb

#executeObject



14
15
16
17
18
19
20
21
22
23
# File 'lib/snip/command/edit.rb', line 14

def execute
  name = @args
  raise NotInitializedError unless Snip::initialized?
  raise SnippetNotFoundError unless Snip::snippet_exists?(name)

  file_path = File.join(Snip::INSTALL_DIR, name)
  if Snip::Util::Editor::open(file_path)
    puts "Snippet updated successfully"
  end
end