Class: Hako::CLI::Rollback
- Inherits:
-
Object
- Object
- Hako::CLI::Rollback
- Defined in:
- lib/hako/cli.rb
Instance Method Summary collapse
Instance Method Details
#parse!(argv) ⇒ Object
127 128 129 130 131 132 133 134 135 136 137 |
# File 'lib/hako/cli.rb', line 127 def parse!(argv) @dry_run = false @verbose = false parser.parse!(argv) @definition_path = argv.first if @definition_path.nil? puts parser.help exit 1 end end |
#parser ⇒ Object
139 140 141 142 143 144 145 146 |
# File 'lib/hako/cli.rb', line 139 def parser @parser ||= OptionParser.new do |opts| opts. = 'hako rollback [OPTIONS] FILE' opts.version = VERSION opts.on('-n', '--dry-run', 'Enable dry-run mode') { @dry_run = true } opts.on('-v', '--verbose', 'Enable verbose logging') { @verbose = true } end end |
#run(argv) ⇒ Object
109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 |
# File 'lib/hako/cli.rb', line 109 def run(argv) parse!(argv) require 'hako/application' require 'hako/commander' if @verbose Hako.logger.level = Logger::DEBUG end = if @dry_run { expand_variables: false, ask_keys: true } else {} end Commander.new(Application.new(@definition_path, **)).rollback(dry_run: @dry_run) end |