use chicken-specific extensions for less code

til #!key #!optional and #!rest

http://wiki.call-cc.org/man/5/Module%20scheme#procedures
This commit is contained in:
pho4cexa 2022-12-16 09:28:54 -08:00 committed by m455
parent f433a6b28a
commit 1209725add

View file

@ -31,10 +31,9 @@
;; end the program immediately.
;; if a message is provided, print it to the screen.
;; exit-status defaults to 1.
(define (bail . args)
(let-optionals args ((msg "") (status 1))
(unless (equal? "" msg) (print msg))
(exit status)))
(define (bail #!optional msg (status 1))
(when msg (print msg))
(exit status))
;; decompose a path s into its constituent parts. returns values:
;;
@ -314,15 +313,14 @@
(when (file-exists? (make-pathname html-repo-path "ISSUES"))
(write-with-template "ISSUES.html" (issueslist->sxml source-files-list)))))
(define (main args)
(let-optionals args ((html-repo-path ""))
(define (main #!optional html-repo-path)
(when (equal? html-repo-path "")
(unless html-repo-path
(bail "please specify a destination directory for html files"))
(unless (in-git-directory?)
(bail "woops this isn't a git directory"))
(generate-html-files html-repo-path)))
(generate-html-files html-repo-path))
(main (command-line-arguments))