From 1209725addeacdaed0ccde8c9262947542d00683 Mon Sep 17 00:00:00 2001 From: pho4cexa Date: Fri, 16 Dec 2022 09:28:54 -0800 Subject: [PATCH] use chicken-specific extensions for less code til #!key #!optional and #!rest http://wiki.call-cc.org/man/5/Module%20scheme#procedures --- main.scm | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/main.scm b/main.scm index 359a9bd..9b2e304 100755 --- a/main.scm +++ b/main.scm @@ -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))