Class: Hako::CLI::Remove

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

Instance Method Summary collapse

Instance Method Details

#parse!(argv) ⇒ Object



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

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



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

def parser
  @parser ||= OptionParser.new do |opts|
    opts.banner = 'hako remove 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
267
# File 'lib/hako/cli.rb', line 261

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

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