Class: Hako::CLI::Stop

Inherits:
Object
  • Object
show all
Defined in:
lib/hako/cli.rb

Instance Method Summary collapse

Instance Method Details

#parse!(argv) ⇒ Object



298
299
300
301
302
303
304
305
306
307
# File 'lib/hako/cli.rb', line 298

def parse!(argv)
  @dry_run = false
  parser.parse!(argv)
  @definition_path = argv.first

  if @definition_path.nil?
    puts parser.help
    exit 1
  end
end

#parserObject



309
310
311
312
313
314
315
# File 'lib/hako/cli.rb', line 309

def parser
  @parser ||= OptionParser.new do |opts|
    opts.banner = 'hako stop FILE'
    opts.version = VERSION
    opts.on('-n', '--dry-run', 'Enable dry-run mode') { @dry_run = true }
  end
end

#run(argv) ⇒ Object



290
291
292
293
294
295
296
# File 'lib/hako/cli.rb', line 290

def run(argv)
  parse!(argv)
  require 'hako/application'
  require 'hako/commander'

  Commander.new(Application.new(@definition_path, expand_variables: false)).stop(dry_run: @dry_run)
end