1
0
mirror of https://github.com/janet-lang/janet synced 2026-04-20 13:51:28 +00:00

Make the -s option more useful.

This commit is contained in:
Calvin Rose
2018-05-07 01:04:24 -04:00
parent 55f0e759d9
commit 104b09d848
4 changed files with 27 additions and 20 deletions

View File

@@ -2,7 +2,7 @@
(var *should-repl* :private false)
(var *no-file* :private true)
(var *use-getline* :private true)
(var *raw-stdin* :private false)
# Flag handlers
(def handlers :private {
@@ -17,7 +17,7 @@
(os-exit 0)
1)
"v" (fn [] (print VERSION) (os-exit 0) 1)
"s" (fn [] (:= *use-getline* false) (:= *should-repl* true) 1)
"s" (fn [] (:= *raw-stdin* true) (:= *should-repl* true) 1)
"r" (fn [] (:= *should-repl* true) 1)
"e" (fn [i]
(:= *no-file* false)
@@ -46,7 +46,10 @@
(getline prompt buf))
(when (or *should-repl* *no-file*)
(print (string "Dst " VERSION " Copyright (C) 2017-2018 Calvin Rose"))
(repl (if *use-getline* xgetline)))
(if *raw-stdin*
(repl nil identity)
(do
(print (string "Dst " VERSION " Copyright (C) 2017-2018 Calvin Rose"))
(repl xgetline))))
)