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 committed 2020-05-30 20:10:10 -07:00
1 parent 289f243095
commit 7c2dce479d
1 file changed
+11 -15
+11 -15
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.