From 1ee7fe8ede94676453906022716e78dfad46cb98 Mon Sep 17 00:00:00 2001 From: Francois-Rene Rideau Date: Thu, 28 Sep 2023 03:55:21 +0000 Subject: [PATCH 1/2] Add -L --load to gxi Also fix a typo in multiple places --- src/gerbil/gxi-main.ss | 9 ++++++++- src/std/actor-v13/rpc/connection.ss | 2 +- src/tools/gxpkg.ss | 2 +- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/gerbil/gxi-main.ss b/src/gerbil/gxi-main.ss index 5d93f63f6..7170b52c9 100644 --- a/src/gerbil/gxi-main.ss +++ b/src/gerbil/gxi-main.ss @@ -40,6 +40,13 @@ (gxi-print-usage!)) ((member hd '("-v" "--version")) (displayln (gerbil-system-version-string))) + ((member hd '("-L" "--load")) + (match rest + ([file . rest] + (load file) + (lp rest)) + (else + (error "missing argument for file to load")))) ((member hd '("-l" "--lang")) (if can-set-lang? (match rest @@ -75,7 +82,7 @@ (enter-repl!) (lp rest)))) ((string-prefix? "-" hd) - (error "uknown option; try -h or --help for options" hd)) + (error "unknown option; try -h or --help for options" hd)) ((string-prefix? ":" hd) (set! can-set-lang? #f) (set! end-interactive? #f) diff --git a/src/std/actor-v13/rpc/connection.ss b/src/std/actor-v13/rpc/connection.ss index 3239b85b0..5c9726828 100644 --- a/src/std/actor-v13/rpc/connection.ss +++ b/src/std/actor-v13/rpc/connection.ss @@ -569,7 +569,7 @@ (begin (warnf "unexpected control message; unknown stream ~a" cont) (unless (!abort? content) - (dispatch-remote-error (make-!error "uknown stream" cont) (message-dest msg))))))) + (dispatch-remote-error (make-!error "unknown stream" cont) (message-dest msg))))))) (def (value-k obj) (##vector-ref obj (fx1- (##vector-length obj)))) diff --git a/src/tools/gxpkg.ss b/src/tools/gxpkg.ss index d84b764f5..0626d4772 100644 --- a/src/tools/gxpkg.ss +++ b/src/tools/gxpkg.ss @@ -417,7 +417,7 @@ ((values pkg tag) (pkg+tag pkg)) (dest (path-expand pkg root))) (unless (file-exists? dest) - (error "Cannot update uknown package" pkg)) + (error "Cannot update unknown package" pkg)) (and (not (file-symbolic-link? dest)) (pkg-fetch-git pkg tag)))) From 0b42badfc1d396479141c703582f27cc0daf922f Mon Sep 17 00:00:00 2001 From: Francois-Rene Rideau Date: Thu, 28 Sep 2023 06:46:24 +0000 Subject: [PATCH 2/2] Support modules in --load --- src/gerbil/gxi-main.ss | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/gerbil/gxi-main.ss b/src/gerbil/gxi-main.ss index 7170b52c9..7656781ca 100644 --- a/src/gerbil/gxi-main.ss +++ b/src/gerbil/gxi-main.ss @@ -8,6 +8,7 @@ (displayln "Options: ") (displayln " -h|--help|help display this help message exit") (displayln " -v||--version|version display the system version and exit") + (displayln " -L|--load module|file import a module (if begins with :) or load a file") (displayln " -l|--lang module set the current interpretation language; must precede any evaluation") (displayln " -e|--eval evaluate an expression") (displayln) @@ -42,8 +43,10 @@ (displayln (gerbil-system-version-string))) ((member hd '("-L" "--load")) (match rest - ([file . rest] - (load file) + ([x . rest] + (if (string-prefix? ":" x) + (eval `(import ,(string->symbol x))) + (load x)) (lp rest)) (else (error "missing argument for file to load"))))