Sha256: 5d4c9ca578d122c6f9c380f64dee55228916eaef61c373548f41b4a705c424f4
Contents?: true
Size: 1.14 KB
Versions: 1
Compression:
Stored size: 1.14 KB
Contents
#!/usr/bin/env ruby require 'coypond' def print_help puts "Usage:" puts " coypond search_term [options] file1 [file2 [file3 [...]]]" puts "" puts "Options:" puts " -m search method names" puts " -c search class names" puts " -M search Module names" puts " -a search all available type names (default: true unless another search option was given)" end if $*.first == "-h" || $*.first == "--help" print_help exit(0) end options = {:search_term => $*.shift} while !$*.empty? and $*.first.start_with?("-") option = $*.shift case option when "-r" options[:regexp] = true when "-i" options[:ignore_case] = true when "-m" options[:method] = true when "-c" options[:class] = true when "-M" options[:module] = true when "-a" options[:all] = true end end options[:all] ||= (options.keys & [:class, :method, :module]).empty? coypond = Coypond::CoypondRunner.new($*) results = coypond.search(options) results.each do |file_name, res| unless res.empty? puts "#{file_name}:" res.each do |dec, location, context| puts " #{location.join(",")}: #{context.strip}" end puts "" end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
coypond-0.1.1 | bin/coypond |