commit 0b8b60c
chld
·
2026-08-15 04:55:08 +0000 UTC
parent 3ae93e1
core cmd functions
M
cmd.scm
+6,
-4
1@@ -2,11 +2,13 @@
2 (define-module (cmd)
3 #:use-module (ice-9 popen)
4 #:use-module (ice-9 rdelim)
5- #:export (System Warn)
6+ #:export (_system _warn die info msg)
7 )
8
9-(define (System . a)
10+(define (_system . a)
11 (let ((p (apply open-pipe* OPEN_READ a)))
12 (display (read-string p))(close-pipe p)))
13-(define (Warn a)
14- (format #t "\x1b[m\x1b[33mwarning: ~a" a)(newline))
15+(define (info a) (format #t "\x1b[m\x1b[37m=> ~a" a)(newline))
16+(define (msg a) (format #t "\x1b[m\x1b[32m==> ~a" a)(newline))
17+(define (_warn a) (format #t "\x1b[m\x1b[33mwarning: ~a" a)(newline))
18+(define (die a) (format #t "\x1b[m\x1b[31mERROR: ~a" a)(quit 1))
M
test.scm
+4,
-4
1@@ -1,5 +1,5 @@
2-(use-modules (cmd)
3- )
4+(use-modules (cmd))
5
6-(Warn "this will be some sort of libdmake.sh helper in guile")
7-(System "ls" "/")
8+(_warn "this will be some sort of libdmake.sh helper in guile")
9+(_system "ls" "/")
10+(die "error")