Sha256: 8d70824a8372216e058fb7eb2b9c686e0225f802cb83787ccab8362515537815
Contents?: true
Size: 1.25 KB
Versions: 4
Compression:
Stored size: 1.25 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 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
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
fcom-0.7.1 | exe/fcom |
fcom-0.7.0 | exe/fcom |
fcom-0.6.0 | exe/fcom |
fcom-0.5.1 | exe/fcom |