feat: provide the zellij version to plugins (#894)
* feat: add draft of feature * feat(wasm): add plugin API for getting of zellij version * feat(wasm): update feedback * delete unnecessary function
This commit is contained in:
parent
cbae0213db
commit
c349586d84
2 changed files with 12 additions and 1 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue