Class: Fcom

Inherits:
Object
  • Object
show all
Extended by:
MemoWise
Defined in:
lib/fcom.rb,
lib/fcom.rb,
lib/fcom/version.rb

Overview

rubocop:disable-next Style/StaticClass

Defined Under Namespace

Modules: OptionsHelpers Classes: ConfigFileOptions, GitHelpers, Parser, Querier

Constant Summary collapse

ROOT_PATH =
'.'
VERSION =
'1.1.0'

Class Method Summary collapse

Class Method Details

.define_slop_options(options) ⇒ Object



50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
# File 'lib/fcom.rb', line 50

def define_slop_options(options)
  git_helpers = Fcom::GitHelpers.new
  default_repo = config_file_options.repo || git_helpers.repo || 'username/repo'

  options.string('--repo', 'GitHub repo (in form `username/repo`)', default: default_repo)
  options.integer('-d', '--days', 'number of days to search back')
  options.integer('-c', '--commits', 'maximum number of commits to show')
  options.bool(
    '-F',
    '--fixed-strings',
    'interpret search string as a fixed string',
    default: false,
  )
  options.bool('-i', '--ignore-case', 'search case-insensitively', default: false)
  options.string(
    '-p',
    '--path',
    'path (directory or file) used to filter results',
    default: Fcom::ROOT_PATH,
  )
  options.string(
    '-a',
    '--author',
    'author',
  )
  options.string(
    '--rg-options',
    'additional options passed directly to `rg` (e.g. `--rg-options "--max-columns 1000"`)',
    default: '--max-columns=2000',
  )
  options.bool('--debug', 'print debugging info', default: false)
  options.bool('--parse-mode', 'whether we are in parse mode', default: false, help: false)
end

.warn_if_config_file_repo_option_missingObject



39
40
41
42
43
44
45
46
47
48
# File 'lib/fcom.rb', line 39

def warn_if_config_file_repo_option_missing
  if config_file_options.repo.blank?
    puts(<<~WARNING.rstrip.yellow)
      Warning: you have not specified a `repo` option in an `.fcom.yml` file.
      This will cause `fcom` to execute more slowly than necessary.
    WARNING
    puts('Execute `fcom --init` to create an `.fcom.yml` file.'.blue.bold)
    puts("See https://github.com/davidrunger/fcom/#readme for more info.\n\n")
  end
end