Sha256: bf9592b3f761ce76f72a9bc5fe64b523b5358e291f5ec566e56e0587658c46d0
Contents?: true
Size: 1.48 KB
Versions: 9
Compression:
Stored size: 1.48 KB
Contents
#!/usr/bin/env ruby # frozen_string_literal: true require 'rainbow/refinement' require 'slop' require_relative '../lib/fcom.rb' using Rainbow opts = Slop.parse do |o| o.banner = <<~BANNER Usage: fcom <search string> [options] Examples: fcom update fcom 'def update' fcom "def update" --days 60 fcom "[Uu]ser.*slug" -d 365 --regex fcom options --path spec/ fcom "line.(green|red)" -d 365 --regex --repo davidrunger/fcom -a "David Runger" BANNER Fcom.define_slop_options(o) o.on('--init', 'create an `.fcom.yml` config file') do File.write('.fcom.yml', "repo: #{Fcom::GitHelpers.new.repo}\n") puts('Created `.fcom.yml` file!'.green.bold) exit end o.on('-v', '--version', 'print the version') do puts(Fcom::VERSION) exit end o.on('-h', '--help', 'print this help information') do puts(o) exit end end # Note: mutating the globally accessible `Fcom.logger` constant like this is not thread-safe Fcom.logger.level = Logger::DEBUG if opts.debug? if !system('which rg > /dev/null') puts("fcom requires that `rg` (ripgrep) be available on your PATH, but it's not.".red) puts('If you are using Homebrew, you can install ripgrep with `brew install ripgrep`.'.blue) exit(1) elsif opts.parse_mode? Fcom::Parser.new(opts).parse elsif !opts.arguments.empty? Fcom.warn_if_config_file_repo_option_missing Fcom::Querier.new(opts).query else puts(opts.options) end
Version data entries
9 entries across 9 versions & 1 rubygems
Version | Path |
---|---|
fcom-0.14.1 | exe/fcom |
fcom-0.14.0 | exe/fcom |
fcom-0.13.0 | exe/fcom |
fcom-0.12.1 | exe/fcom |
fcom-0.12.0 | exe/fcom |
fcom-0.11.0 | exe/fcom |
fcom-0.10.0 | exe/fcom |
fcom-0.9.0 | exe/fcom |
fcom-0.8.0 | exe/fcom |