Class: DnsMadeEasy::CLI::Commands::Zone::Format
- Defined in:
- lib/dnsmadeeasy/cli/commands/zone.rb
Overview
Formats a standard DNS zone file into canonical output.
Constant Summary
Constants inherited from Base
Base::DEFAULT_CREDENTIAL_PATHS, Base::SUPPORTED_FORMATS
Constants included from MessageHelpers
Instance Method Summary collapse
Methods included from MessageHelpers
error, included, info, print_box, success, warn
Instance Method Details
#call(file:) ⇒ Object
47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/dnsmadeeasy/cli/commands/zone.rb', line 47 def call(file:, **) result = DnsMadeEasy::Zone::Parser.new(::File.read(file)).call if result.success? puts DnsMadeEasy::Zone::Serializer.new(result.value!) success("Zone file formatted.\nRecords: #{result.value!.records.length}") else error("Zone file is invalid.\n#{result.failure.join("\n")}") raise ReportedError, 'zone file is invalid' end end |