public
Description: Go plugins used by sbraford. Feel free to clone individually or as a whole.
Homepage:
Clone URL: git://github.com/sbraford/go-plugins.git
go-plugins / find_in.rb
100644 17 lines (15 sloc) 0.444 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
class FindIn < Go::Plugin
  call_with 'find in'
  usage 'find in <search_path> <part_of_a_filename>'
  
  def run
    if @options.params.size < 2
      puts "Please provide a search path & filename string to grep for."
    else
      @path = @options.params[1]
      @filename = @options.params[2]
      puts "Searching for '#{@filename}' in: #{@path}"
      @cmd = "find #{@path} | grep \"#{@filename}\""
      system(@cmd)
    end
  end
end