tvl-depot/users/sterni/mblog/cli.lisp
sterni 56ec3b1803 refactor(sterni/mblog): add (sub)class for apple note messages
* Upon creation of an apple-note object we can check if certain fields
  we are interested in are present and of the right type etc.

  These currently are:

  - UUID (for links later)
  - Subject (title)
  - Time
  - Text part with supported MIME type

  These are then put into their own shortcut fields in the apple-note
  subclass which allows for easier access and forces us to make sure
  they are present.

* Split out everything note related into its own package. Using the new
  type, we can expose an interface which sort of makes sense.

Change-Id: Ic9d67518354e61a3cc8388bb0e566fce661e90d0
Reviewed-on: https://cl.tvl.fyi/c/depot/+/5072
Tested-by: BuildkiteCI
Reviewed-by: sterni <sternenseemann@systemli.org>
2022-02-02 20:47:45 +00:00

18 lines
709 B
Common Lisp

(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 (note:apple-note-html-fragment
(note:make-apple-note (mime:mime-message (pathname arg)))
*standard-output*)))))