Class: Puppetize::CommandLine

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

Constant Summary collapse

SUB_COMMANDS =
%w(init build reset)

Instance Method Summary collapse

Constructor Details

#initialize(usage_msg = nil) ⇒ CommandLine

Returns a new instance of CommandLine.



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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/puppetize/command_line.rb', line 11

def initialize(usage_msg = nil)


  opts = Trollop::options do
    version "puppetize 0.0.1 (c) 2013 Breinlinger Juan Paulo"
    banner "\nPuppetize is a tool to automate puppet module development\n\nUsage:\n   puppetize <subcommand> [options] \n\nwhere <subcommands> are:\n\n  init              Initialize the environment\n  build             Build the puppet module\n  reset             Reset the inital state\n\nAnd [options] are:\n\n    EOS\n\n\n    #opt :ignore, \"Ignore incorrect values\"\n    #opt :file, \"Extra data filename to read in, with a very long option description like this one\", :type => String\n    #opt :volume, \"Volume level\", :default => 3.0\n    #opt :iters, \"Number of iterations\", :default => 5\n  end\n\n\n  cmd = ARGV.shift # get the subcommand\n  cmd_opts = case cmd\n             when \"init\"\n               Puppetize::Controler.new.init\n             when \"build\"\n               Puppetize::Controler.new.build\n             when \"reset\"\n               Puppetize::Controler.new.reset\n             else\n               Trollop::die \"Unknown subcommand \#{cmd.inspect}\"\n             end      \n\nend\n"