zone, frontend: Open up the writing of zones to files.
[zone] / frontend.lisp
index ef9c090..46c5a36 100644 (file)
@@ -30,6 +30,8 @@
 
 (defvar opt-zones nil
   "Which zones to be emitted.")
+(defvar opt-format :bind
+  "Which format to use on output.")
 
 (eval-when (:compile-toplevel :load-toplevel)
   (defopthandler dir (var arg) ()
                      (#\d "directory" (:arg "DIRECTORY")
                           (dir *zone-output-path*)
                           "Write zone and serial files to DIRECTORY.")
+                     (#\F "format" (:arg "FORMAT")
+                          (keyword opt-format
+                                   (delete-duplicates
+                                    (loop for method in
+                                          (pcl:generic-function-methods
+                                           #'zone:zone-write)
+                                          for specs =
+                                          (pcl:method-specializers method)
+                                          if (typep (car specs)
+                                                    'pcl:eql-specializer)
+                                          collect
+                                          (pcl:eql-specializer-object
+                                           (car specs)))))
+                          "Format to use for output.")
                      (#\z "zone" (:arg "NAME") (list opt-zones)
                           "Write information about zone NAME.")))
 
@@ -72,6 +88,6 @@
                                       :use '(#:common-lisp #:net #:zone))))
          (load f :verbose nil :print nil :if-does-not-exist :error)
          (delete-package *package*)))
-      (zone-save opt-zones))))
+      (zone-save opt-zones :format opt-format))))
 
 ;;;----- That's all, folks --------------------------------------------------