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