mirror of
https://github.com/janet-lang/janet
synced 2025-01-25 22:56:52 +00:00
Add -c option to main client
This allows compile janet source modules to images.
This commit is contained in:
parent
efab484fff
commit
3b6ff3c09a
@ -15,15 +15,16 @@
|
|||||||
(print "usage: " (get process/args 0) " [options] script args...")
|
(print "usage: " (get process/args 0) " [options] script args...")
|
||||||
(print
|
(print
|
||||||
`Options are:
|
`Options are:
|
||||||
-h Show this help
|
-h : Show this help
|
||||||
-v Print the version string
|
-v : Print the version string
|
||||||
-s Use raw stdin instead of getline like functionality
|
-s : Use raw stdin instead of getline like functionality
|
||||||
-e Execute a string of janet
|
-e code : Execute a string of janet
|
||||||
-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
|
-c source output : Compile janet source code into an image
|
||||||
-- Stop handling options`)
|
-l path : Execute code in a file before running the main script
|
||||||
|
-- : Stop handling options`)
|
||||||
(os/exit 0)
|
(os/exit 0)
|
||||||
1)
|
1)
|
||||||
"v" (fn [&] (print janet/version "-" janet/build) (os/exit 0) 1)
|
"v" (fn [&] (print janet/version "-" janet/build) (os/exit 0) 1)
|
||||||
@ -31,6 +32,11 @@
|
|||||||
"r" (fn [&] (set *should-repl* true) 1)
|
"r" (fn [&] (set *should-repl* true) 1)
|
||||||
"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)
|
||||||
|
"c" (fn [i &]
|
||||||
|
(def e (require (get process/args (+ i 1))))
|
||||||
|
(spit (get process/args (+ i 2)) (make-image e))
|
||||||
|
(set *no-file* false)
|
||||||
|
3)
|
||||||
"-" (fn [&] (set *handleopts* false) 1)
|
"-" (fn [&] (set *handleopts* false) 1)
|
||||||
"l" (fn [i &]
|
"l" (fn [i &]
|
||||||
(import* *env* (get process/args (+ i 1))
|
(import* *env* (get process/args (+ i 1))
|
||||||
|
Loading…
Reference in New Issue
Block a user