diff --git a/zellij-server/src/wasm_vm.rs b/zellij-server/src/wasm_vm.rs index 5e1b159d7d..6ee37ad3e9 100644 --- a/zellij-server/src/wasm_vm.rs +++ b/zellij-server/src/wasm_vm.rs @@ -28,7 +28,7 @@ use crate::{ }; use zellij_utils::{ - consts::ZELLIJ_PROJ_DIR, + consts::{VERSION, ZELLIJ_PROJ_DIR}, errors::{ContextType, PluginContext}, }; use zellij_utils::{ @@ -262,6 +262,7 @@ pub(crate) fn zellij_exports(store: &Store, plugin_env: &PluginEnv) -> ImportObj host_unsubscribe, host_set_selectable, host_get_plugin_ids, + host_get_zellij_version, host_open_file, host_switch_tab_to, host_set_timeout, @@ -311,6 +312,10 @@ fn host_get_plugin_ids(plugin_env: &PluginEnv) { wasi_write_object(&plugin_env.wasi_env, &ids); } +fn host_get_zellij_version(plugin_env: &PluginEnv) { + wasi_write_string(&plugin_env.wasi_env, VERSION); +} + fn host_open_file(plugin_env: &PluginEnv) { let path: PathBuf = wasi_read_object(&plugin_env.wasi_env); plugin_env diff --git a/zellij-tile/src/shim.rs b/zellij-tile/src/shim.rs index c664d36b04..e3537053ca 100644 --- a/zellij-tile/src/shim.rs +++ b/zellij-tile/src/shim.rs @@ -27,6 +27,11 @@ pub fn get_plugin_ids() -> PluginIds { object_from_stdin().unwrap() } +pub fn get_zellij_version() -> String { + unsafe { host_get_zellij_version() }; + object_from_stdin().unwrap() +} + // Host Functions pub fn open_file(path: &Path) { @@ -66,6 +71,7 @@ extern "C" { fn host_unsubscribe(); fn host_set_selectable(selectable: i32); fn host_get_plugin_ids(); + fn host_get_zellij_version(); fn host_open_file(); fn host_switch_tab_to(tab_idx: u32); fn host_set_timeout(secs: f64);