mirror of
https://github.com/janet-lang/janet
synced 2024-09-28 07:08:14 +00:00
Update highlight and the mainclient.
This commit is contained in:
parent
f7a0133eb1
commit
737b2449f0
@ -12,7 +12,7 @@
|
|||||||
# Flag handlers
|
# Flag handlers
|
||||||
(def handlers :private
|
(def handlers :private
|
||||||
{"h" (fn [&]
|
{"h" (fn [&]
|
||||||
(print "usage: " (get process/args 0) " [options] scripts...")
|
(print "usage: " (get process/args 0) " [options] script args...")
|
||||||
(print
|
(print
|
||||||
`Options are:
|
`Options are:
|
||||||
-h Show this help
|
-h Show this help
|
||||||
@ -22,6 +22,7 @@
|
|||||||
-r Enter the repl after running all scripts
|
-r Enter the repl after running all scripts
|
||||||
-p Keep on executing if there is a top level error (persistent)
|
-p Keep on executing if there is a top level error (persistent)
|
||||||
-q Hide prompt, logo, and repl output (quiet)
|
-q Hide prompt, logo, and repl output (quiet)
|
||||||
|
-l Execute code in a file before running the main script
|
||||||
-- Stop handling options`)
|
-- Stop handling options`)
|
||||||
(os/exit 0)
|
(os/exit 0)
|
||||||
1)
|
1)
|
||||||
@ -31,6 +32,10 @@
|
|||||||
"p" (fn [&] (set *exit-on-error* false) 1)
|
"p" (fn [&] (set *exit-on-error* false) 1)
|
||||||
"q" (fn [&] (set *quiet* true) 1)
|
"q" (fn [&] (set *quiet* true) 1)
|
||||||
"-" (fn [&] (set *handleopts* false) 1)
|
"-" (fn [&] (set *handleopts* false) 1)
|
||||||
|
"l" (fn [i &]
|
||||||
|
(import* *env* (get process/args (+ i 1))
|
||||||
|
:prefix "" :exit *exit-on-error*)
|
||||||
|
2)
|
||||||
"e" (fn [i &]
|
"e" (fn [i &]
|
||||||
(set *no-file* false)
|
(set *no-file* false)
|
||||||
(eval-string (get process/args (+ i 1)))
|
(eval-string (get process/args (+ i 1)))
|
||||||
@ -50,11 +55,11 @@
|
|||||||
(do
|
(do
|
||||||
(set *no-file* false)
|
(set *no-file* false)
|
||||||
(import* *env* arg :prefix "" :exit *exit-on-error*)
|
(import* *env* arg :prefix "" :exit *exit-on-error*)
|
||||||
(++ i))))
|
(set i lenargs))))
|
||||||
|
|
||||||
(when (or *should-repl* *no-file*)
|
(when (or *should-repl* *no-file*)
|
||||||
(if-not *quiet*
|
(if-not *quiet*
|
||||||
(print "Janet " janet/version "-" janet/build " Copyright (C) 2017-2018 Calvin Rose"))
|
(print "Janet " janet/version "-" janet/build " Copyright (C) 2017-2019 Calvin Rose"))
|
||||||
(defn noprompt [_] "")
|
(defn noprompt [_] "")
|
||||||
(defn getprompt [p]
|
(defn getprompt [p]
|
||||||
(def offset (parser/where p))
|
(def offset (parser/where p))
|
||||||
|
@ -162,9 +162,9 @@
|
|||||||
(defn html
|
(defn html
|
||||||
"Highlight janet source code and output HTML."
|
"Highlight janet source code and output HTML."
|
||||||
[source]
|
[source]
|
||||||
(string "<pre class=\"j-main\">"
|
(string "<pre class=\"j-main\"><code>"
|
||||||
(0 (peg/match html-grammar source))
|
(0 (peg/match html-grammar source))
|
||||||
"</pre>"))
|
"</code></pre>"))
|
||||||
|
|
||||||
(defn html-file
|
(defn html-file
|
||||||
"Highlight a janet file and print out a highlighted HTML version
|
"Highlight a janet file and print out a highlighted HTML version
|
||||||
|
Loading…
Reference in New Issue
Block a user