about summary refs log tree commit diff
path: root/users/sterni/mblog/cli.lisp
blob: 93be7e8b8e44221f2e50277c34fce152c0e084ca (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
(in-package :mblog)
(declaim (optimize (safety 3)))

(defparameter +synopsis+ "mnote-html FILE [FILE [ ... ]]")

;; TODO(sterni): handle relevant conditions
(defun main ()
  (let* ((args (uiop:command-line-arguments))
         (help-p (or (not args)
                     (find-if (lambda (x)
                                (member x '("-h" "--help" "--usage")
                                        :test #'string=))
                              args))))
    (if help-p (format *error-output* "Usage: ~A~%" +synopsis+)
      (loop for arg in args
            do (apple-note-html-fragment
                (mime:mime-message (pathname arg)) *standard-output*)))))