lib/snibbets.rb in snibbets-2.0.22 vs lib/snibbets.rb in snibbets-2.0.23
- old
+ new
@@ -167,19 +167,21 @@
tags = langs.map { |lang| Lexers.ext_to_lang(lang) }.concat(langs).delete_if(&:nil?).sort.uniq
exts = langs if exts.empty?
filename = "#{title}#{exts.map { |x| ".#{x}"}.join('')}.#{Snibbets.options[:extension]}"
-
- File.open(File.join(File.expand_path(Snibbets.options[:source]), filename), 'w') do |f|
+ filepath = File.join(File.expand_path(Snibbets.options[:source]), filename)
+ File.open(filepath, 'w') do |f|
f.puts "tags: #{tags.join(', ')}
```
#{pb}
```"
end
puts "New snippet written to #{filename}."
+
+ open_snippet_in_editor(filepath) if Snibbets.arguments[:edit_snippet]
end
def handle_launchbar(results)
output = []