2026-08-29 02:06:14 +00:00
|
|
|
mod files;
|
|
|
|
|
|
2026-08-29 01:43:12 +00:00
|
|
|
use renamr_core::format::ExpressionFormat;
|
|
|
|
|
use renamr_core::string_bindings;
|
|
|
|
|
use std::collections::HashMap;
|
|
|
|
|
|
|
|
|
|
/// Renders a naming-scheme expression against a set of binding values.
|
|
|
|
|
/// This is the Tauri-facing entry point into the core format engine, used by the
|
|
|
|
|
/// rename-preview panel in the UI so users see live results as they edit a pattern.
|
|
|
|
|
#[tauri::command]
|
|
|
|
|
fn render_expression(expression: String, bindings: HashMap<String, String>) -> Result<String, String> {
|
|
|
|
|
let compiled = ExpressionFormat::compile(&expression).map_err(|e| e.to_string())?;
|
|
|
|
|
compiled
|
|
|
|
|
.format(&string_bindings(bindings))
|
|
|
|
|
.map_err(|e| e.to_string())
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#[cfg_attr(mobile, tauri::mobile_entry_point)]
|
|
|
|
|
pub fn run() {
|
|
|
|
|
tauri::Builder::default()
|
2026-08-29 02:06:14 +00:00
|
|
|
.plugin(tauri_plugin_dialog::init())
|
|
|
|
|
.invoke_handler(tauri::generate_handler![
|
|
|
|
|
render_expression,
|
|
|
|
|
files::pick_files,
|
|
|
|
|
files::pick_folder,
|
|
|
|
|
files::expand_dropped_paths,
|
|
|
|
|
])
|
2026-08-29 01:43:12 +00:00
|
|
|
.run(tauri::generate_context!())
|
|
|
|
|
.expect("error while running Renamr");
|
|
|
|
|
}
|