lib/format.rb in yac-1.3.0 vs lib/format.rb in yac-1.3.1
- old
+ new
@@ -12,13 +12,13 @@
def format_file(file)
colorful(file,"filename") if file
case `file "#{file}" 2>/dev/null`
when / PDF document/
- puts Pdf_Error unless system("#{Yac::CONFIG["pdf_command"]||'evince'} '#{file}' 2>/dev/null")
+ colorful(Pdf_Error,'warn') unless system("#{Yac::CONFIG["pdf_command"]||'evince'} '#{file}' 2>/dev/null")
when /( image )|(\.svg)/
- puts Image_Error unless system("#{Yac::CONFIG["image_command"]||'eog'} '#{file}' 2>/dev/null")
+ colorful(Image_Error,'warn') unless system("#{Yac::CONFIG["image_command"]||'eog'} '#{file}' 2>/dev/null")
when /Office Document/
open_office(file)
else
if File.extname(file) =~ /^\.(od[tfspg]|uof)$/ #Support odf uof ods odp...
open_office(file)
@@ -43,13 +43,13 @@
end
def edit_file(file)
case `file "#{file}" 2>/dev/null`
when / PDF /
- puts Pdf_Error unless system("#{Yac::CONFIG["pdf_edit_command"]||'ooffice'} '#{file}' 2>/dev/null")
+ colorful(Pdf_Error,'warn') unless system("#{Yac::CONFIG["pdf_edit_command"]||'ooffice'} '#{file}' 2>/dev/null")
when /( image )|(\.svg)/
- puts Image_Error unless system("#{Yac::CONFIG["image_edit_command"]||'gimp'} '#{file}' 2>/dev/null")
+ colorful(Image_Error,'warn') unless system("#{Yac::CONFIG["image_edit_command"]||'gimp'} '#{file}' 2>/dev/null")
when /Office Document/
open_office(file)
else
if File.extname(file) =~ /^\.(od[tfspg]|uof)$/ #Support odf uof ods odp...
open_office(file)
@@ -58,15 +58,15 @@
end
end
end
def open_office(file)
- puts Office_Error unless system("#{Yac::CONFIG["office_command"]||'ooffice'} '#{file}' 2>/dev/null")
+ colorful(Office_Error,'warn') unless system("#{Yac::CONFIG["office_command"]||'ooffice'} '#{file}' 2>/dev/null")
end
def edit_text(file)
prepare_dir(file)
- puts Doc_Error unless system("#{Yac::CONFIG["editor"] || ENV['EDITOR'] ||'vim'} '#{file}' 2>/dev/null")
+ colorful(Doc_Error,'warn') unless system("#{Yac::CONFIG["editor"] || ENV['EDITOR'] ||'vim'} '#{file}' 2>/dev/null")
end
def colorful(stuff,level="text",line_break = true)
stuff = empha(stuff,level)
print "\e[%sm%s\e[0m " % [Yac::CONFIG[level],stuff.rstrip]