Permalink
Browse files

Added zcat / gzcat detection.

  • Loading branch information...
1 parent 85f0115 commit 05adb3df8829536b04e4a454ff19b009402ebef0 @watsonian watsonian committed with Dec 7, 2009
Showing with 2 additions and 1 deletion.
  1. 0 bin/clarity
  2. +2 −1 lib/clarity/commands/grep_command_builder.rb
View
0 bin/clarity 100644 → 100755
File mode changed.
View
3 lib/clarity/commands/grep_command_builder.rb
@@ -39,7 +39,8 @@ def exec_functions
def gzip_tools
- terms.empty? ? ['gzcat filename'] : ['zgrep options -e term filename'] + ['grep options -e term'] * (terms.size-1)
+ cat_tool = (ENV["PATH"].split(":").find{|d| File.exists?(File.join(d, "gzcat"))} ? "zcat" : "gzcat")
+ terms.empty? ? ["#{cat_tool} filename"] : ['zgrep options -e term filename'] + ['grep options -e term'] * (terms.size-1)
end
def bzip_tools

0 comments on commit 05adb3d

Please sign in to comment.