lib/snibbets.rb in snibbets-2.0.17 vs lib/snibbets.rb in snibbets-2.0.18

- old
+ new

@@ -155,11 +155,13 @@ title = input unless input.empty? printf 'What language(s) does it use (separate with spaces, full names or file extensions will work)? ' input = $stdin.gets.chomp langs = input.split(/ +/).map(&:strip) unless input.empty? - exts = langs.map { |lang| Lexers.lang_to_ext(lang) } - tags = langs.map { |lang| Lexers.ext_to_lang(lang) }.concat(langs).sort.uniq + exts = langs.map { |lang| Lexers.lang_to_ext(lang) }.delete_if(&:nil?) + tags = langs.map { |lang| Lexers.ext_to_lang(lang) }.concat(langs).delete_if(&:nil?).sort.uniq + + exts = langs if exts.empty? filename = "#{title}.#{exts.join('.')}.#{Snibbets.options[:extension]}" File.open(File.join(File.expand_path(Snibbets.options[:source]), filename), 'w') do |f| f.puts "tags: #{tags.join(', ')}