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



268
269
270
271
272
273
274
275
276
277
# File 'lib/hako/cli.rb', line 268

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

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

#parserObject



279
280
281
282
283
284
285
# File 'lib/hako/cli.rb', line 279

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



261
262
263
264
265
266
# File 'lib/hako/cli.rb', line 261

def run(argv)
  parse!(argv)
  require 'hako/application'
  require 'hako/commander'
  Commander.new(Application.new(@yaml_path)).stop(dry_run: @dry_run)
end