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



263
264
265
266
267
268
269
270
271
272
# File 'lib/hako/cli.rb', line 263

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



274
275
276
277
278
279
280
# File 'lib/hako/cli.rb', line 274

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



255
256
257
258
259
260
261
# File 'lib/hako/cli.rb', line 255

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