summaryrefslogtreecommitdiff
path: root/Biz/Repl.py
diff options
context:
space:
mode:
Diffstat (limited to 'Biz/Repl.py')
-rw-r--r--Biz/Repl.py14
1 files changed, 13 insertions, 1 deletions
diff --git a/Biz/Repl.py b/Biz/Repl.py
index 0732fae..9844abf 100644
--- a/Biz/Repl.py
+++ b/Biz/Repl.py
@@ -13,6 +13,7 @@ def use(ns: str, path: str) -> None:
Load or reload the module named 'ns' from 'path'. Like `use` in the Guile
Scheme repl.
"""
+ info(f"loading {ns} from {path}")
spec = importlib.util.spec_from_file_location(ns, path)
module = importlib.util.module_from_spec(spec)
# delete module and its imported names if its already loaded
@@ -27,10 +28,21 @@ def use(ns: str, path: str) -> None:
globals().update({k: getattr(module, k) for k in names})
+def info(s):
+ print(f"info: repl: {s}")
+
+
if __name__ == "__main__":
NS = sys.argv[1]
PATH = sys.argv[2]
use(NS, PATH)
- def r():
+ info("use reload() or _r() after making changes")
+ sys.ps1 = f"{NS}> "
+ sys.ps2 = f"{NS}| "
+
+ def reload():
+ return use(NS, PATH)
+
+ def _r():
return use(NS, PATH)