use rhai::{Array, Engine}; use crate::scripting::{Server, SshKey}; mod servers_table; mod ssh_keys_table; pub fn pretty_print_dispatch(array: Array) { println!("pretty print dispatch"); if array.is_empty() { println!(""); return; } let first = &array[0]; if first.is::() { servers_table::pretty_print_servers(array); } else if first.is::() { ssh_keys_table::pretty_print_ssh_keys(array); } else { // Generic fallback for other types for item in array { println!("{}", item.to_string()); } } } pub fn register(engine: &mut Engine) { engine.register_fn("pretty_print", pretty_print_dispatch); }