aboutsummaryrefslogtreecommitdiffstats
path: root/csc/main.csc
diff options
context:
space:
mode:
Diffstat (limited to 'csc/main.csc')
-rw-r--r--csc/main.csc10
1 files changed, 9 insertions, 1 deletions
diff --git a/csc/main.csc b/csc/main.csc
index 1e2cde1..9dae75f 100644
--- a/csc/main.csc
+++ b/csc/main.csc
@@ -1,4 +1,6 @@
(import (scheme base)
+ (only (scheme file)
+ open-binary-output-file)
(only (scheme read)
read)
(only (csc compiler)
@@ -23,6 +25,7 @@
(define-flag *include* "include" (lambda (s) (cons s *include*)) '())
(define-flag *output* "output" string-copy "")
(define-flag *help* "help" bool-flag #f)
+(define-flag *h* "h" bool-flag #f)
(define *help-msg*
@@ -32,6 +35,8 @@
This flag can be passed more than once.
--output FILE Write output to the given file. The default is
to immediately execute.
+
+ --help,-h Print the usage message.
")
@@ -54,7 +59,7 @@
(printf "Error: could not parse flag {}: {}\n{}" (parse-error-flag e) (parse-error-msg e) *help-msg*)
(exit 2)))
(parse-flags))
- (when *help*
+ (when (or *help* *h*)
(printf "{}" *help-msg*)
(exit 0))
(when (string=? "" *output*)
@@ -66,3 +71,6 @@
(exit 2))))
(set! *library-search-dirs* *include*)
(write-file *output* (compile (read-file input-file))))
+
+
+(main)