Method: Lather::Cli#initialize

Defined in:
lib/lather/cli.rb

#initializeCli

Returns a new instance of Cli.



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/lather/cli.rb', line 7

def initialize
  @command = nil
  @globs = []
  @verbose = false

  @options = OptionParser.new do |o|
    o.banner = "#$0 [-hVv] [-r <cmd>] <globs...>"
    o.separator ""

    o.on "--help", "-h", "-?", "Shows help." do
      exit help!
    end

    o.on "--verbose", "-v", "Talks your ear off." do
      @verbose = true
    end

    o.on "--version", "-V", "Prints #{Lather::VERSION}." do
      puts Lather::VERSION
      exit
    end

    o.on "--rinse [cmd]", "--run", "-r", "Runs when things change." do |cmd|
      @command = cmd
    end

    o.separator ""
  end
end