Sha256: 64b07b9617f8d8d5a3599a5af996f6f410d122823b685507fbe390c8a9787314

Contents?: true

Size: 1.98 KB

Versions: 7

Compression:

Stored size: 1.98 KB

Contents

#!/usr/bin/env ruby
require 'rubygems'
gem 'main', '>=2.8.0'
require 'main'
require File.join(File.dirname(__FILE__), %w(.. lib grepmate))

Main {
  option('case') {
    cast :bool
    description 'Case sensitive search (default is off).'
  }

  option('textmate', 't') {
    cast :bool
    description 'open matches in textmate'
  }
  
  option('html') {
    cast :bool
    description 'Turn on html output (default)'
  }

  option('text') {
    cast :bool
    description 'show matches as text, file and line number'
  }

  option('file_and_line', 'f') {
    cast :bool
    description 'output only match file and line number'
  }

  option('rails', 'r') {
    cast :bool
    description 'Search Rails source, in addition to whatever is named by dir parameter etc.'
  }
  
  option('only_rails', 'R') {
    cast :bool
    description 'Search only Rails source, not the project.  Takes precedence over dir parameter'
  }

  option('gems', 'g') {
    cast :bool
    description "Search all gems, in addition to whatever is named by dir parameter etc."
  }

  option('only_gems', 'G') {
    cast :bool
    description "Search only gems, not the project.  Takes precedence over dir parameter"
  }

  option('wait', 'w') {
    cast :bool
    description 'Wait between finds until TextMate file is closed.  Only works with textmate output (--textmate or -t).'
  }

  option('count', 'c') {
    cast :bool
    description 'Display only the number of matches.'
  }

  option('regex', 'e') {
    description 'use regular expression search terms'
  }
  
  option('verbose', 'v') {
    description 'Turn on verbose mode and explain everything'
  }

  keyword('dir', 'd') {
    arity -1
    description 'Directories to search. Defaults to project dirs.'
  }
  
  argument('what_to_search_for') {
    arity -1
    description "Search terms.  Enclose in quotes to search for phrase.  use with -e or --regex option for regular expression support"
  }

  def run
    grepmate = Grepmate.new(params)
    grepmate.find
    grepmate.display
  end
}

Version data entries

7 entries across 7 versions & 2 rubygems

Version Path
ssoroka-grepmate-2.0.0 bin/grepmate
ssoroka-grepmate-2.0.1 bin/grepmate
ssoroka-grepmate-2.0.2 bin/grepmate
ssoroka-grepmate-2.0.3 bin/grepmate
ssoroka-grepmate-2.0.4 bin/grepmate
ssoroka-grepmate-2.0.5 bin/grepmate
grepmate-2.0.5 bin/grepmate