1
0
mirror of https://github.com/janet-lang/janet synced 2024-11-10 18:59:54 +00:00

Add -m option to command line

The -m option set the default system path for finding libraries
for that invocation of Janet.
This commit is contained in:
Calvin Rose 2019-02-18 15:06:17 -05:00
parent 540b326c54
commit 6af5800d21
2 changed files with 4 additions and 0 deletions

View File

@ -2,6 +2,8 @@
All notable changes to this project will be documented in this file.
## 0.4.0 - ??
- Add `-m` flag to main client to allow specifying where to load
system modules from.
- Add `-c` flag to main client to allow compiling Janet modules to images.
- Add `string/format` and `buffer/format`.
- Remove `string/pretty` and `string/number`.

View File

@ -22,6 +22,7 @@
-r : Enter the repl after running all scripts
-p : Keep on executing if there is a top level error (persistent)
-q : Hide prompt, logo, and repl output (quiet)
-m syspath : Set system path for loading global modules
-c source output : Compile janet source code into an image
-l path : Execute code in a file before running the main script
-- : Stop handling options`)
@ -32,6 +33,7 @@
"r" (fn [&] (set *should-repl* true) 1)
"p" (fn [&] (set *exit-on-error* false) 1)
"q" (fn [&] (set *quiet* true) 1)
"m" (fn [i &] (set module/*syspath* (get process/args (+ i 1))) 2)
"c" (fn [i &]
(def e (require (get process/args (+ i 1))))
(spit (get process/args (+ i 2)) (make-image e))