13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
# File 'lib/vagrant-autodns/commands/delete.rb', line 13
def execute
require_relative '../autodnsdb'
opts = OptionParser.new do |optp|
optp.banner = "Usage: vagrant autodns delete <hostname>"
end
argv = parse_options(opts) || return
raise Vagrant::Errors::CLIInvalidUsage, :help => opts.help.chomp if (argv.length != 1)
db = VagrantAutoDNS.autodnsdb
hostname = argv[0]
if db.delete_record(hostname)
@env.ui.info("Host #{hostname} deleted")
0
else
@env.ui.error("Host #{hostname} not deleted")
1
end
end
|