Sha256: c7567aa9ee1d81d1fe812c986ee58376112d3a079798880a1f8a476d9120f18e

Contents?: true

Size: 557 Bytes

Versions: 20

Compression:

Stored size: 557 Bytes

Contents

#!/usr/bin/env ruby
# frozen_string_literal: true

# List files that matches with some expression
# Usage:
#
# ruby examples/find_usage.rb defs
#
# Or be explicit about directory or folder:
#
# ruby examples/find_usage.rb defs lib/
$LOAD_PATH.unshift(File.expand_path('lib', __dir__))

require 'fast'
require 'coderay'

arguments = ARGV
pattern = arguments.shift
files = Fast.ruby_files_from(arguments.any? ? arguments : '.')
files.select do |file|
  begin
    puts file if Fast.search_file(pattern, file).any?
  rescue Parser::SyntaxError
    []
  end
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
ffast-0.2.2 examples/find_usage.rb
ffast-0.2.0 examples/find_usage.rb
ffast-0.1.9 examples/find_usage.rb
ffast-0.1.8 examples/find_usage.rb
ffast-0.1.7 examples/find_usage.rb
ffast-0.1.6 examples/find_usage.rb
ffast-0.1.5 examples/find_usage.rb
ffast-0.1.4 examples/find_usage.rb
ffast-0.1.3 examples/find_usage.rb
ffast-0.1.2 examples/find_usage.rb
ffast-0.1.1 examples/find_usage.rb
ffast-0.1.0 examples/find_usage.rb
ffast-0.0.9 examples/find_usage.rb
ffast-0.0.8 examples/find_usage.rb
ffast-0.0.7 examples/find_usage.rb
ffast-0.0.6 examples/find_usage.rb
ffast-0.0.5 examples/find_usage.rb
ffast-0.0.4 examples/find_usage.rb
ffast-0.0.3 examples/find_usage.rb
ffast-0.0.2 examples/find_usage.rb