mirror of
https://github.com/janet-lang/janet
synced 2025-11-18 00:05:13 +00:00
More work on renaming functions. Change long string syntax to use
backticks. Allow custom masks in fibers for custom error and debug handling.
This commit is contained in:
@@ -6,24 +6,24 @@
|
||||
|
||||
# Flag handlers
|
||||
(def handlers :private {
|
||||
"h" (fn []
|
||||
(print "usage: " (get args 0) " [options] scripts...")
|
||||
(print "Options are:")
|
||||
(print " -h Show this help")
|
||||
(print " -v Print the version string")
|
||||
(print " -s Use raw stdin instead of getline like functionality")
|
||||
(print " -e Execute a string of dst")
|
||||
(print " -r Enter the repl after running all scripts")
|
||||
(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)
|
||||
"e" (fn [i]
|
||||
(:= *no-file* false)
|
||||
(eval (get args (+ i 1)))
|
||||
2)
|
||||
})
|
||||
"h" (fn []
|
||||
(print "usage: " (get args 0) " [options] scripts...")
|
||||
(print "Options are:")
|
||||
(print " -h Show this help")
|
||||
(print " -v Print the version string")
|
||||
(print " -s Use raw stdin instead of getline like functionality")
|
||||
(print " -e Execute a string of dst")
|
||||
(print " -r Enter the repl after running all scripts")
|
||||
(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)
|
||||
"e" (fn [i]
|
||||
(:= *no-file* false)
|
||||
(eval (get args (+ i 1)))
|
||||
2)
|
||||
})
|
||||
|
||||
(defn- dohandler [n i]
|
||||
(def h (get handlers n))
|
||||
@@ -33,13 +33,13 @@
|
||||
(var i 1)
|
||||
(def lenargs (length args))
|
||||
(while (< i lenargs)
|
||||
(def arg (get args i))
|
||||
(if (= "-" (string.slice arg 0 1))
|
||||
(+= i (dohandler (string.slice arg 1 2) i))
|
||||
(do
|
||||
(:= *no-file* false)
|
||||
(import arg)
|
||||
(++ i))))
|
||||
(def arg (get args i))
|
||||
(if (= "-" (string.slice arg 0 1))
|
||||
(+= i (dohandler (string.slice arg 1 2) i))
|
||||
(do
|
||||
(:= *no-file* false)
|
||||
(import arg)
|
||||
(++ i))))
|
||||
|
||||
(when (or *should-repl* *no-file*)
|
||||
(if *raw-stdin*
|
||||
@@ -47,5 +47,7 @@
|
||||
(do
|
||||
(print (string "Dst " VERSION " Copyright (C) 2017-2018 Calvin Rose"))
|
||||
(repl (fn [buf p]
|
||||
(def prompt (string (parser.state p) "> "))
|
||||
(getline prompt buf)))))))
|
||||
(def prompt (string (parser.state p) "> "))
|
||||
(getline prompt buf))))))
|
||||
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user