Class: Wright::CLI

Inherits:
Object
  • Object
show all
Defined in:
lib/wright/cli.rb

Overview

Wright command-line interface.

Instance Method Summary collapse

Constructor Details

#initialize(main) ⇒ CLI

Returns a new instance of CLI.


7
8
9
10
11
12
# File 'lib/wright/cli.rb', line 7

def initialize(main)
  @commands = []
  @requires = []
  @main = main
  set_up_parser
end

Instance Method Details

#run(argv) ⇒ Object

Runs a wright script with the supplied arguments.

Parameters:

  • argv (Array<String>)

    the arguments passed to bin/wright


17
18
19
20
21
22
23
24
25
26
27
# File 'lib/wright/cli.rb', line 17

def run(argv)
  arguments = parse(argv)
  return if quit

  Wright.activate_dry_run if dry_run
  Wright.log.level = log_level if log_level
  main.extend Wright::DSL
  requires.each { |r| require r }

  run_script(arguments)
end