using the planet-command line parsers

This commit is contained in:
Danny Yoo 2011-06-17 16:58:21 -04:00
parent 70d77bf34a
commit cafd001f9b
3 changed files with 8 additions and 38 deletions

View File

@ -2,7 +2,8 @@
# raco make -v --disable-inline test-analyzer.rkt
# racket test-analyzer.rkt
launcher: whalesong
launcher:
raco make -v --disable-inline whalesong.rkt
racket make-launcher.rkt
whalesong:

View File

@ -1,8 +1,10 @@
#lang racket/base
;; copy of launcher/launcher since it has a bug. I'll send a bug patch
;; upstream.
;; copy of launcher/launcher since it has a bug in 5.1.1.
;; The bug's fixed in later versions of Racket, but my local machine still
;; has 5.1.1. As soon as I switch over, this module will lose
;; its meaning.
(require scheme/path

View File

@ -27,30 +27,10 @@
;; TODO: error trapping
(define commands `((build
,(lambda (args)
(do-the-build args)))
(get-runtime
,(lambda (args)
(print-the-runtime)))
(get-javascript
,(lambda (args)
(get-javascript-code (first args))))))
;; listof string
(define command-names (map (lambda (x) (symbol->string (car x)))
commands))
(define (print-expected-command)
(printf "Expected one of the following: [~a].\n"
(string-join command-names ", ")))
(define (at-toplevel)
(svn-style-command-line
#:program (short-program+command-name)
#:program "whalesong" #;(short-program+command-name)
#:argv (current-command-line-arguments)
"The Whalesong command-line tool for compiling Racket to JavaScript"
["build" "build a standalone xhtml package"
@ -64,20 +44,7 @@
["get-javascript" "Gets just the JavaScript code and prints it to standard output"
"Builds a racket program into JavaScript. The outputted file depends on the runtime."
#:args (file)
(get-javascript-code file)])
#;(define args (vector->list (current-command-line-arguments)))
#;(cond [(empty? args)
(print-expected-command)]
[else
(cond
[(assoc (string->symbol (first args))
commands)
=>
(lambda (p)
((cadr p) (rest args)))]
[else
(printf "Unknown command ~s.\n" (first args))
(print-expected-command)])]))
(get-javascript-code file)]))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;