1
0
mirror of https://github.com/janet-lang/janet synced 2025-10-25 12:47:42 +00:00

Fix init.dst, work on metabuild tool to make

native module creation easier
This commit is contained in:
Calvin Rose
2018-08-03 21:50:32 -04:00
parent 9cad4eb91d
commit 169a22f03e
2 changed files with 60 additions and 9 deletions

View File

@@ -10,7 +10,7 @@
# Flag handlers
(def handlers :private
{"h" (fn []
{"h" (fn @[]
(print "usage: " (get args 0) " [options] scripts...")
(print
`Options are:
@@ -23,17 +23,17 @@
-- Stop handling options`)
(os.exit 0)
1)
"v" (fn [] (print VERSION) (os.exit 0) 1)
"s" (fn [] (:= *raw-stdin* true) (:= *should-repl* true) 1)
"r" (fn [] (:= *should-repl* true) 1)
"p" (fn [] (:= *exit-on-error* false) 1)
"-" (fn [] (:= *handleopts* false) 1)
"e" (fn [i]
"v" (fn @[] (print VERSION) (os.exit 0) 1)
"s" (fn @[] (:= *raw-stdin* true) (:= *should-repl* true) 1)
"r" (fn @[] (:= *should-repl* true) 1)
"p" (fn @[] (:= *exit-on-error* false) 1)
"-" (fn @[] (:= *handleopts* false) 1)
"e" (fn @[i]
(:= *no-file* false)
(eval (get args (+ i 1)))
2)})
(defn- dohandler [n i]
(defn- dohandler @[n i]
(def h (get handlers n))
(if h (h i) (print "unknown flag -" n)))
@@ -54,7 +54,7 @@
(repl nil identity)
(do
(print (string "Dst " VERSION " Copyright (C) 2017-2018 Calvin Rose"))
(repl (fn [buf p]
(repl (fn @[buf p]
(def [line] (parser.where p))
(def prompt (string "dst:" line ":" (parser.state p) "> "))
(getline prompt buf)))))))