Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save edbond/71947 to your computer and use it in GitHub Desktop.
Save edbond/71947 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
require 'rubygems'
require 'trollop'
config = {:step_type => 'Given,When,Then'}
opts = Trollop.options do
opt :step_type, "Given, When or Then", :type => :string, :default => config[:step_type]
end
term = ARGV.last
regexp_step_types = opts[:step_type].split(',').join('|')
FEATURE_DIR = 'features/step_definitions'
result = system "egrep -rih '^\s*(#{regexp_step_types}).*#{term}' #{FEATURE_DIR}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment