commit 8beaf23468dc2d38357dbad0bb165c8eeb3d5501
parent 6657afd7f24752a16272eab467a974571a07d8ca
Author: Sylvia Ivory <git@sivory.net>
Date: Wed, 2 Jul 2025 01:38:19 -0700
Update readme
Diffstat:
3 files changed, 60 insertions(+), 17 deletions(-)
diff --git a/readme.md b/readme.md
@@ -1,6 +1,6 @@
# Månen
-Fancy Lua REPl! Featuring support for Lua 5.1-5.4, LuaJIT, and Luau!
+Fancy Lua REPl! Featuring support for Lua 5.1-5.4, LuaJIT, and more!
## Features
@@ -12,9 +12,52 @@ Fancy Lua REPl! Featuring support for Lua 5.1-5.4, LuaJIT, and Luau!
## Running
+Månen has the following feature flags:
+* `vendored` - Compile and embed Lua into the executable
+* `lua51` - `lua54` - Use Lua 5.1-5.4 for the embedded runtime
+* `luajit(52)` - Use LuaJIT(5.2 compatibility) for the embedded runtime
+
+### Examples
+
```bash
cargo run # Uses vendored Lua 5.4 by default
-cargo run --no-default-features --features lua52 # Uses system Lua 5.2
-cargo run --no-default-features --features vendored,luau[-vector4] # Uses vendored Luau (with vector4)
-cargo run --no-default-features --features vendored,luau-jit # Uses vendored Luau with JIT
+cargo run --no-default-features lua52,vendored # Uses vendored Lua 5.2
+cargo run --no-default-features lua53,vendored # Uses system Lua 5.3
+```
+
+## Additional runtimes
+
+Månen can support any Lua runtime that has the following APIs
+* `loadstring` / `load`
+* `io.stdin`
+* `io.write`
+* `io.flush`
+
+If you want state-preserving cancellation, `debug.sethook` is required.
+
+## Configuration file
+
+Configuration can be specified at `$XDG_CONFIG_HOME/manen/config.lua` or `$HOME/.config/manen/config.lua`.
+
+```lua
+-- default config.lua
+
+-- embedded - Use the embedded Lua interpreter as specified in feature flags
+-- system - Use a foreign runtime that meets the requirements in additional runtimes
+-- If this option is specified, system_lua must be specified
+manen.executor = 'embedded'
+
+-- **full** path to Lua executable
+manen.system_lua = nil
+
+-- inspect - Use Lua-like table printing
+-- address - Print addresses of tables like the original Lua REPL
+-- comfytable - Use https://github.com/nukesor/comfy-table for table printing
+manen.table_format = 'inspect'
+
+-- size of history in terms of lines stored
+manen.history_size = 256
+
+-- if the output should be colored
+manen.color_output = true
```
diff --git a/src/config.rs b/src/config.rs
@@ -13,13 +13,7 @@ pub enum Executor {
Embedded,
}
-impl Default for Executor {
- fn default() -> Self {
- Self::Embedded
- }
-}
-
-#[derive(Clone, Default, FromLua)]
+#[derive(Clone, FromLua)]
pub struct Config {
pub executor: Executor,
pub system_lua: Option<PathBuf>,
@@ -28,6 +22,18 @@ pub struct Config {
pub color_output: bool,
}
+impl Default for Config {
+ fn default() -> Self {
+ Self {
+ executor: Executor::Embedded,
+ system_lua: None,
+ table_format: TableFormat::Inspect,
+ history_size: 256,
+ color_output: true,
+ }
+ }
+}
+
impl Config {
pub fn load() -> LuaResult<Self> {
let config = Self::default();
diff --git a/src/inspect.rs b/src/inspect.rs
@@ -355,12 +355,6 @@ pub enum TableFormat {
Address,
}
-impl Default for TableFormat {
- fn default() -> Self {
- Self::Inspect
- }
-}
-
fn comfy_table_inner(
tbl: &LuaTable,
recursive: bool,