pub mod bookmarks;
pub mod lua_api;
#[allow(unused_imports)]
pub use lua_api::{PluginEngine, PluginError};
pub const EXAMPLE_BOOKMARKS_PLUGIN: &str = include_str!("example_bookmarks.lua");
pub fn load_enabled_plugins(engine: &mut PluginEngine, enabled: &[String]) {
for name in enabled {
match name.as_str() {
"bookmarks" => {
if let Err(e) = engine.load_plugin_str("bookmarks", EXAMPLE_BOOKMARKS_PLUGIN) {
tracing::debug!("failed to load built-in bookmarks plugin: {e}");
} else {
tracing::debug!("loaded built-in plugin: bookmarks");
}
}
other => {
let plugin_path = match crate::paths::config_dir() {
Some(dir) => dir.join(other).with_extension("lua"),
None => std::path::PathBuf::from(other).with_extension("lua"),
};
if let Err(e) = engine.load_plugin(&plugin_path) {
tracing::debug!("failed to load plugin '{other}': {e}");
} else {
tracing::debug!("loaded plugin: {other}");
}
}
}
}
}