diff --git a/CHANGELOG.md b/CHANGELOG.md index 06c03207..0fbff89e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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`. diff --git a/src/mainclient/init.janet b/src/mainclient/init.janet index d10dbec9..25fba0ca 100644 --- a/src/mainclient/init.janet +++ b/src/mainclient/init.janet @@ -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))