(use-package :chains) (alexandria:define-constant +command-line-options+ '((:help #\h) (:help "help") (:use #\u :required) (:use "use" :required) (:use #\i :required) (:use "include" :required)) :test #'equal :documentation "") (defun help () (format t "~&Usage: chains [OPTION]... FILE... -i, --include -u, --use -h, --help ")) (defun parse-arguments (command-line-arguments) (multiple-value-bind (options others unknowns) (just-getopt-parser:getopt command-line-arguments +command-line-options+) (cond ((assoc :help options) (help) (sb-posix:exit 0)) (unknowns (help) (sb-posix:exit 1)) (t (loop :for (option . value) :in options :do (case option )))) others)) (defun chains () (let ((files (parse-arguments (uiop:command-line-arguments)))) (dolist (file files) (with-open-file (stream file :direction :input) (mapc (alexandria:compose #'princ #'chains::content) (alexandria:flatten (chains:eval-tree chains:*default-environment* (chains:build-tree (chains:read-tokens stream)))))))))