Files
rabby/rabby-core/src/lib.rs
T
2026-07-06 11:02:46 +00:00

60 lines
1.7 KiB
Rust

//! Core feature model for Rabby, a Rust/Tauri terminal workspace inspired by Tabby.
//!
//! This crate is intentionally dependency-light so terminal/profile/session behavior can be
//! unit-tested without starting the desktop shell.
pub mod feature;
pub mod workspace;
pub use feature::{
all_features, feature_by_key, feature_matrix, FeatureArea, FeatureSpec, FeatureStatus,
};
pub use workspace::{ConnectionKind, PaneNode, Profile, SplitAxis, Tab, Workspace};
impl Workspace {
pub fn feature_matrix() -> Vec<(&'static str, &'static str)> {
feature_matrix()
}
}
pub fn slug(input: &str) -> String {
let mut out = String::new();
let mut last_dash = false;
for ch in input.trim().chars() {
if ch.is_ascii_alphanumeric() {
out.push(ch.to_ascii_lowercase());
last_dash = false;
} else if !last_dash {
out.push('-');
last_dash = true;
}
}
out.trim_matches('-').to_string()
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn slug_normalizes_profile_ids() {
assert_eq!(slug(" SSH: Prod Box "), "ssh-prod-box");
}
#[test]
fn exported_feature_matrix_mentions_tabby_capabilities() {
let text = Workspace::feature_matrix()
.iter()
.map(|(a, b)| format!("{a} {b}"))
.collect::<Vec<_>>()
.join("\n")
.to_lowercase();
for needle in [
"terminal", "ssh", "telnet", "serial", "split", "unicode", "quake", "zmodem", "plugin",
"portable", "shortcut", "theme", "sftp", "secret",
] {
assert!(text.contains(needle), "missing {needle}");
}
}
}