1
1
mirror of https://github.com/wez/wezterm.git synced 2024-12-25 06:12:16 +03:00

wezterm: config: don't require that config files have .lua extension

This makes things a bit more convenient when testing and removes
an `unreachable!` that was actually reachable if you set
WEZTERM_CONFIG_FILE.
This commit is contained in:
Wez Furlong 2020-05-30 20:10:10 -07:00
parent 289f243095
commit 7c2dce479d

View File

@ -620,21 +620,17 @@ impl Config {
let cfg: Self;
if p.extension() == Some(OsStr::new("lua")) {
let lua = crate::scripting::make_lua_context(p)?;
let config: mlua::Value = lua
.load(&s)
.set_name(p.to_string_lossy().as_bytes())?
.eval()?;
cfg = crate::scripting::from_lua_value(config).with_context(|| {
format!(
"Error converting lua value returned by script {} to Config struct",
p.display()
)
})?;
} else {
unreachable!();
}
let lua = crate::scripting::make_lua_context(p)?;
let config: mlua::Value = lua
.load(&s)
.set_name(p.to_string_lossy().as_bytes())?
.eval()?;
cfg = crate::scripting::from_lua_value(config).with_context(|| {
format!(
"Error converting lua value returned by script {} to Config struct",
p.display()
)
})?;
// Compute but discard the key bindings here so that we raise any
// problems earlier than we use them.