From 7c2dce479d2aa1d959af5e7032991ef5086966f1 Mon Sep 17 00:00:00 2001 From: Wez Furlong Date: Sat, 30 May 2020 20:10:10 -0700 Subject: [PATCH] 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. --- src/config/mod.rs | 26 +++++++++++--------------- 1 file changed, 11 insertions(+), 15 deletions(-) diff --git a/src/config/mod.rs b/src/config/mod.rs index ae6590cd0..c83a06f07 100644 --- a/src/config/mod.rs +++ b/src/config/mod.rs @@ -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.