%%%--------------------------------------------------------------------------
\section{Option parser} \label{sec:misc.optparse}
-These symbols are defined in the @|optparse| package.
+Most of these symbols are defined in the @|optparse| package.
\begin{describe}{fun}{exit \&optional (@<code> 0) \&key :abrupt}
\end{describe}
@<form>^*) @}^*}
\end{describe}
+\begin{describe}{fun}{augment-options @<options-list>}
+\end{describe}
+
%%%--------------------------------------------------------------------------
\section{Property sets} \label{sec:misc.pset}
(defun update-usage ()
(setf *usage* (simple-usage *options* "SOURCES...")))
+(export 'augment-options)
+(defun augment-options (options)
+ "Add OPTIONS to the program's options list."
+ (asetf *options* (append it options))
+ (setf (op-options *option-parser*) *options*)
+ (update-usage))
+
+(use-package "SOD-FRONTEND" "SOD-USER")
+
(export 'main)
(defun main ()
(#\d "directory" (:arg "DIR")
("Write output files to DIR.")
(dirpath output-path))
+ (#\e "eval" (:arg "LISP")
+ ("Evaluate raw Lisp code.")
+ (lambda (lisp)
+ (handler-case
+ (let ((*package* (find-package "SOD-USER")))
+ (eval (read-from-string lisp)))
+ (error (error)
+ (option-parse-error "~A" error)))))
+ (#\l "load" (:arg "FILE")
+ ("Load a file of Lisp code.")
+ (lambda (file)
+ (let ((file (merge-pathnames file
+ (make-pathname
+ :type "LISP"
+ :case :common))))
+ (handler-case
+ (let ((*package* (find-package "SOD-USER")))
+ (find-file *default-pathname-defaults* file
+ "Lisp file"
+ (lambda (path true)
+ (declare (ignore path))
+ (load true
+ :verbose nil
+ :print nil))))
+ (error (error)
+ (option-parse-error "~A" error))))))
(#\p "stdout"
("Write output files to standard output.")
(set stdoutp))