From 2af64d17be76007a57233e20347f8851d5c6729b Mon Sep 17 00:00:00 2001 From: Alexander Rosenberg Date: Mon, 23 Feb 2026 12:05:08 -0800 Subject: [PATCH] Add man page --- clash/.gitignore | 4 +++- clash/Makefile | 19 +++++++++++++++++-- clash/clash.lisp | 13 ++++++++++++- 3 files changed, 32 insertions(+), 4 deletions(-) diff --git a/clash/.gitignore b/clash/.gitignore index 8d45870..7acaae4 100644 --- a/clash/.gitignore +++ b/clash/.gitignore @@ -1 +1,3 @@ -clash \ No newline at end of file +clash +clash.md +clash.1 diff --git a/clash/Makefile b/clash/Makefile index e90f938..3d8a0c3 100644 --- a/clash/Makefile +++ b/clash/Makefile @@ -1,13 +1,28 @@ LISP=sbcl -all: clash +PREFIX=~/.local + +all: clash clash.1 clash: clash.asd format.lisp parse-date.lisp clash.lisp $(LISP) --eval '(ql:quickload :clash)' \ --eval '(asdf:make :clash)' \ --eval '(uiop:quit)' +clash.md: clash.asd format.lisp parse-date.lisp clash.lisp + $(LISP) --eval '(ql:quickload :clash)' \ + --eval '(clash:make-markdown-doc)' \ + --eval '(uiop:quit)' \ + -- clash.md + +clash.1: clash.md + go-md2man clash.1 + +install: clash clash.1 + install -D clash $(PREFIX)/bin/ + install -D clash.1 $(PREFIX)/share/man/man1/ + clean: - rm -f clash + rm -f clash clash.md clash.1 .PHONY: all clean diff --git a/clash/clash.lisp b/clash/clash.lisp index 807a291..b07407a 100644 --- a/clash/clash.lisp +++ b/clash/clash.lisp @@ -15,7 +15,8 @@ #:read-directorysizes-for-trash-directory #:write-directorysizes-for-trash-directory) (:use #:cl #:clash/parse-date #:clash/format) - (:export #:toplevel)) + (:export #:toplevel + #:make-markdown-doc)) (in-package :clash) @@ -1041,3 +1042,13 @@ Args can be supplied to facilitate testing in SLIME." (clingon:run (toplevel/command) args) (clingon:run (toplevel/command))) (flush-directorysizes-cache))) + +;; Used from the build system +(defun make-markdown-doc () + "Generate documentation in a markdown format." + ;; the first argument is "--" + (let ((target (second (uiop:command-line-arguments)))) + (with-open-file (out target :direction :output + :if-exists :overwrite + :if-does-not-exist :create) + (clingon:print-documentation :markdown (toplevel/command) out))))