cs: further corrections to racket command-line argument handling

This commit is contained in:
Matthew Flatt 2019-12-26 07:02:01 -06:00
parent ccbd93e49c
commit e6e28fa8b7

View File

@ -322,6 +322,7 @@
[else [else
(set! remaining-command-line-arguments (vector->immutable-vector (set! remaining-command-line-arguments (vector->immutable-vector
(list->vector args))) (list->vector args)))
(no-init! saw)
(when (and (null? args) (not (saw? saw 'non-config))) (when (and (null? args) (not (saw? saw 'non-config)))
(set! repl? #t) (set! repl? #t)
(when text-repl? (when text-repl?
@ -359,7 +360,7 @@
(let-values ([(file-name rest-args) (next-arg "file name" arg within-arg args)]) (let-values ([(file-name rest-args) (next-arg "file name" arg within-arg args)])
(set! loads (cons (lambda () (load file-name)) (set! loads (cons (lambda () (load file-name))
loads)) loads))
(flags-loop rest-args (see saw 'non-config)))] (flags-loop rest-args (see saw 'non-config 'top)))]
[("-r" "--script") [("-r" "--script")
(let-values ([(file-name rest-args) (next-arg "file name" arg within-arg args)]) (let-values ([(file-name rest-args) (next-arg "file name" arg within-arg args)])
(set! loads (cons (lambda () (load file-name)) (set! loads (cons (lambda () (load file-name))
@ -390,7 +391,7 @@
vals))) vals)))
(loop)))) (loop))))
loads)) loads))
(flags-loop rest-args (see saw 'non-config)))] (flags-loop rest-args (see saw 'non-config 'top)))]
[("-k") [("-k")
(let*-values ([(n rest-args) (next-arg "starting and ending offsets" arg within-arg args)] (let*-values ([(n rest-args) (next-arg "starting and ending offsets" arg within-arg args)]
[(m rest-args) (next-arg "first ending offset" arg within-arg (cons "-k" rest-args))] [(m rest-args) (next-arg "first ending offset" arg within-arg (cons "-k" rest-args))]
@ -416,7 +417,7 @@
[("-m" "--main") [("-m" "--main")
(set! loads (cons (lambda () (call-main)) (set! loads (cons (lambda () (call-main))
loads)) loads))
(flags-loop (cdr args) (see saw 'non-config))] (flags-loop (cdr args) (see saw 'non-config 'top))]
[("-i" "--repl") [("-i" "--repl")
(set! repl? #t) (set! repl? #t)
(set! version? #t) (set! version? #t)