Module: Reviewer::Arguments::Options

Defined in:
lib/reviewer/arguments/options.rb

Overview

Defines the command-line flags rvw and fmt accept.

Separate from Arguments because declaring what can be parsed and answering questions about what was parsed are different jobs, and only the second one needs instance state.

Class Method Summary collapse

Class Method Details

.configure(opts, files_callback: nil) ⇒ void

This method returns an undefined value.

Declares every flag on the given Slop parser :reek:TooManyStatements -- a flag declaration list, not branching logic

Parameters:

  • the parser being configured



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/reviewer/arguments/options.rb', line 18

def configure(opts, files_callback: nil)
  # Narrowing what gets reviewed
  opts.array '-f', '--files', 'a list of comma-separated files or paths',
             delimiter: ',', default: [], &files_callback
  opts.array '-t', '--tags', 'a list of comma-separated tags', delimiter: ',', default: []

  # Selecting how results are displayed
  opts.on '-r', '--raw', 'force raw output (no capturing)'
  opts.on '-j', '--json', 'output results as JSON'
  opts.string '--format', 'output format (streaming, summary, json)', default: 'streaming'

  # Reporting on Reviewer itself, then exiting early
  opts.on '-v', '--version', 'print the version'
  opts.on '-h', '--help', 'print the help'
  opts.on '-c', '--capabilities', 'output capabilities as JSON'
end