Commits

Anonymous committed 66ef590

Extract a few things to utils.scm

Comments (0)

Files changed (3)

 (require-library setup-api)
 (import (only setup-api remove-directory))
 (include "chicken-env")
-
-(define (printf-error msg . args)
-  (display "ERROR: " (current-error-port))
-  (apply fprintf (current-error-port) msg args)
-  (newline (current-error-port)))
-
-(define (printf-newline msg . args)
-  (apply printf msg args)
-  (newline))
+(include "utils")
 
 (define (usage #!optional (print printf-newline))
   (print "Usage: ~A [OPTION ...] NAME
 (define chicken-coop (or (get-environment-variable "CHICKENS") "~/chickens"))
 (define chicken-link "use-this")
 
-(define (fail msg . args)
-  (apply fprintf (current-error-port) msg args)
-  (newline (current-error-port))
-  (exit 1))
-
 (define (assert-chicken-coop-exists)
   (unless (and (file-exists? chicken-coop) (directory? chicken-coop))
-    (fail "CHICKENS does not exist or is not a directory: ~S" chicken-coop)))
+    (fail "CHICKENS does not exist or is not a directory: ~S" chicken-coop)))
+(define (printf-error msg . args)
+  (display "ERROR: " (current-error-port))
+  (apply fprintf (current-error-port) msg args)
+  (newline (current-error-port)))
+
+(define (printf-newline msg . args)
+  (apply printf msg args)
+  (newline))
+
+(define (fail msg . args)
+  (apply printf-error msg args)
+  (newline (current-error-port))
+  (exit 1))