Permalink
Browse files

change discovery of file type to use file command instead of file ext…

…ension
  • Loading branch information...
1 parent 542dacb commit 111f50dde36ed46f7aac8f57ba55c88577cc180f John Williams committed Feb 22, 2011
Showing with 7 additions and 4 deletions.
  1. +7 −4 lib/clarity/commands/grep_command_builder.rb
@@ -30,10 +30,13 @@ def command
def exec_functions
- case File.extname(filename)
- when '.gz' then gzip_tools
- when '.bz2' then bzip_tools
- else default_tools
+ type = `file #{filename}`
+ if type.include?("gzip")
+ gzip_tools
+ elsif type.include?("bzip2")
+ bzip_tools
+ else
+ default_tools
end
end

0 comments on commit 111f50d

Please sign in to comment.