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



240
241
242
243
244
245
246
247
248
249
# File 'lib/hako/cli.rb', line 240

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



251
252
253
254
255
256
257
# File 'lib/hako/cli.rb', line 251

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



233
234
235
236
237
238
# File 'lib/hako/cli.rb', line 233

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