lib/zonesync/cli.rb in zonesync-0.8.0 vs lib/zonesync/cli.rb in zonesync-0.9.0
- old
+ new
@@ -1,21 +1,27 @@
require "thor"
module Zonesync
class CLI < Thor
default_command :sync
- desc "sync", "syncs the contents of Zonefile to the DNS server configured in Rails.application.credentials.zonesync"
+ desc "sync --source=Zonefile --destination=zonesync", "syncs the contents of the Zonefile to the DNS server configured in Rails.application.credentials.zonesync"
+ option :source, default: "Zonefile", desc: "path to the zonefile"
+ option :destination, default: "zonesync", desc: "key to the DNS server configuration in Rails.application.credentials"
method_option :dry_run, type: :boolean, default: false, aliases: :n, desc: "log operations to STDOUT but don't perform the sync"
def sync
- Zonesync.call dry_run: options[:dry_run]
+ kwargs = options.to_hash.transform_keys(&:to_sym)
+ Zonesync.call(**kwargs)
rescue ConflictError, MissingManifestError, ChecksumMismatchError => e
puts e.message
exit 1
end
- desc "generate", "generates a Zonefile from the DNS server configured in Rails.application.credentials.zonesync"
+ desc "generate --source=zonesync --destination=Zonefile", "generates a Zonefile from the DNS server configured in Rails.application.credentials.zonesync"
+ option :source, default: "zonesync", desc: "key to the DNS server configuration in Rails.application.credentials"
+ option :destination, default: "Zonefile", desc: "path to the zonefile"
def generate
- Zonesync.generate
+ kwargs = options.to_hash.transform_keys(&:to_sym)
+ Zonesync.generate(**kwargs)
end
def self.exit_on_failure? = true
end
end