Sha256: ba9e001c17964ce9895f7db4d94c3069f714a5e38c28a203f6d3653c3bc2e06d
Contents?: true
Size: 1.21 KB
Versions: 4
Compression:
Stored size: 1.21 KB
Contents
#!/usr/bin/env ruby # frozen_string_literal: true require 'slop' require_relative '../lib/fcom.rb' 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.5.0 | exe/fcom |
fcom-0.4.3 | exe/fcom |
fcom-0.4.2 | exe/fcom |
fcom-0.4.1 | exe/fcom |