Class: Teaspoon::CommandLine

Inherits:
Object
  • Object
show all
Defined in:
lib/teaspoon/command_line.rb

Instance Method Summary collapse

Constructor Details

#initializeCommandLine

Returns a new instance of CommandLine.



8
9
10
11
12
13
14
15
16
# File 'lib/teaspoon/command_line.rb', line 8

def initialize
  @options = {}
  @options[:files] = opt_parser.parse!

  require_console
  abort if Teaspoon::Console.new(@options).failures?
rescue Teaspoon::EnvironmentNotFound => e
  abort("#{e.message}\nConsider using -r path/to/teaspoon_env\n")
end

Instance Method Details

#opt_parserObject



18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/teaspoon/command_line.rb', line 18

def opt_parser
  OptionParser.new do |parser|
    @parser = parser
    @parser.banner = "Usage: teaspoon [options] [files]\n\n"

    opts_for_general
    opts_for_filtering
    opts_for_output
    opts_for_coverage
    opts_for_utility
  end
end