X-Git-Url: https://git.distorted.org.uk/~mdw/zone/blobdiff_plain/7fff37978d8a36109b20a60b9beaf90e137d3c64..716105aa3a725242d5fac82bab8db82e0bb46995:/frontend.lisp diff --git a/frontend.lisp b/frontend.lisp index 5241be0..46c5a36 100644 --- a/frontend.lisp +++ b/frontend.lisp @@ -30,12 +30,46 @@ (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) () + (let ((path (probe-file arg))) + (if (and path + (not (pathname-name path))) + (setf var path) + (option-parse-error "path `~A' doesn't name a directory." arg))))) (define-program :version "1.0.0" :usage "ZONEDEF..." :help "Generates BIND zone files from Lisp descriptions." :options (options help-options + "Parsing options" + (#\f "feature" (:arg "KEYWORD") + (list *features* 'keyword) + "Insert KEYWORD in *features* list.") + (#\s "subnet" (:arg "NET") + (list zone:*preferred-subnets*) + "Designate NET as a preferred subnet.") "Output options" + (#\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."))) @@ -54,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 --------------------------------------------------