Module: R10K::CLI

Defined in:
lib/r10k/cli.rb,
lib/r10k/cli/help.rb,
lib/r10k/cli/deploy.rb,
lib/r10k/cli/version.rb,
lib/r10k/cli/puppetfile.rb

Defined Under Namespace

Modules: Deploy, Puppetfile, Version

Class Method Summary collapse

Class Method Details

.commandObject



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
36
37
38
39
40
41
42
43
44
45
# File 'lib/r10k/cli.rb', line 8

def self.command
  @cmd ||= Cri::Command.define do
    name    'r10k'
    usage   'r10k <subcommand> [options]'
    summary 'Killer robot powered Puppet environment deployment'
    description "      r10k is a suite of commands to help deploy and manage puppet code for\n      complex environments.\n    EOD\n\n\n    flag :h, :help, 'Show help for this command' do |value, cmd|\n      # This is evil because we may not necessarily be called from the\n      # command line and have a meaningful ARGV to scan. However the best\n      # way of having a globally useful --help command is to define the\n      # behavior in the block of the option to immediately handle it and exit\n      # and we don't have access to the verbose option, so the simple method\n      # is to simply scan ARGV.\n      verbose = (ARGV.include?('-v') || ARGV.include?('--verbose'))\n      puts cmd.help(:verbose => verbose)\n      exit 0\n    end\n\n    flag :t, :trace, 'Display stack traces on application crash'\n\n    loglevels = R10K::Logging::LOG_LEVELS.reverse.map(&:downcase).join(\", \")\n    optional :v, :verbose, \"Set log verbosity. Valid values: \#{loglevels}\"\n\n    flag nil, :color, 'Enable colored log messages'\n\n    required :c, :config, 'Specify a global configuration file'\n\n    run do |opts, args, cmd|\n      puts cmd.help(:verbose => opts[:verbose])\n      exit 0\n    end\n  end\nend\n"