alf/models/mod.rs
1//! Data models for representing shell aliases and functions.
2
3use serde::{Deserialize, Serialize};
4use std::path::PathBuf;
5
6/// Type of shell entry
7#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
8pub enum EntryType {
9 /// Shell alias
10 Alias,
11 /// Shell function
12 Function,
13}
14
15/// Represents a parsed alias or function from a shell file
16#[derive(Debug, Clone, Serialize, Deserialize)]
17pub struct AliasEntry {
18 /// Name of the alias or function
19 pub name: String,
20 /// Whether this is an alias or function
21 pub entry_type: EntryType,
22 /// The command or function body
23 pub value: String,
24 /// Optional comments providing description and context
25 pub comments: Option<Vec<String>>,
26 /// Source file where this entry was found
27 pub source_file: PathBuf,
28}
29
30/// Search result with match score
31#[derive(Debug, Clone)]
32pub struct SearchResult {
33 /// The matched entry
34 pub entry: AliasEntry,
35 /// Match score from fuzzy matcher (higher is better)
36 pub score: u32,
37}