//! Mock data for TUI development and testing.
use std::path::PathBuf;
use crate::models::{AliasEntry, EntryType};
/// Generate a set of realistic mock alias and function entries.
///
/// This data is used during development to populate the TUI and
/// is also useful for unit/integration tests of the parser and search modules.
pub fn mock_entries() -> Vec<AliasEntry> {
vec![
// ── Aliases ──────────────────────────────────────────
AliasEntry {
name: "gs".to_string(),
entry_type: EntryType::Alias,
value: "git status".to_string(),
comments: Some(vec!["Check git working tree status".to_string()]),
source_file: PathBuf::from("~/.zshrc"),
},
AliasEntry {
name: "ga".to_string(),
entry_type: EntryType::Alias,
value: "git add".to_string(),
comments: Some(vec!["Stage files for commit".to_string()]),
source_file: PathBuf::from("~/.zshrc"),
},
AliasEntry {
name: "gc".to_string(),
entry_type: EntryType::Alias,
value: "git commit".to_string(),
comments: Some(vec!["Create a new commit".to_string()]),
source_file: PathBuf::from("~/.zshrc"),
},
AliasEntry {
name: "gp".to_string(),
entry_type: EntryType::Alias,
value: "git push".to_string(),
comments: Some(vec!["Push commits to remote".to_string()]),
source_file: PathBuf::from("~/.zshrc"),
},
AliasEntry {
name: "gl".to_string(),
entry_type: EntryType::Alias,
value: "git log --oneline --graph --decorate".to_string(),
comments: Some(vec![
"View compact git log with graph".to_string(),
"Shows branch topology and tags".to_string(),
]),
source_file: PathBuf::from("~/.stupidlylongsourcefilenamerc"),
},
AliasEntry {
name: "ll".to_string(),
entry_type: EntryType::Alias,
value: "ls -lah".to_string(),
comments: Some(vec!["List files in long format with hidden files".to_string()]),
source_file: PathBuf::from("~/.bashrc"),
},
AliasEntry {
name: "..".to_string(),
entry_type: EntryType::Alias,
value: "cd ..".to_string(),
comments: Some(vec!["Navigate up one directory".to_string()]),
source_file: PathBuf::from("~/.bashrc"),
},
AliasEntry {
name: "...".to_string(),
entry_type: EntryType::Alias,
value: "cd ../..".to_string(),
comments: Some(vec!["Navigate up two directories".to_string()]),
source_file: PathBuf::from("~/.stupidlylongsourcefilenamerc"),
},
AliasEntry {
name: "proj".to_string(),
entry_type: EntryType::Alias,
value: "cd ~/projects".to_string(),
comments: Some(vec!["Navigate to projects directory".to_string()]),
source_file: PathBuf::from("~/.zshrc"),
},
AliasEntry {
name: "dps".to_string(),
entry_type: EntryType::Alias,
value: "docker ps".to_string(),
comments: Some(vec!["List running Docker containers".to_string()]),
source_file: PathBuf::from("~/.zshrc"),
},
AliasEntry {
name: "grep".to_string(),
entry_type: EntryType::Alias,
value: "grep --color=auto".to_string(),
comments: None,
source_file: PathBuf::from("~/.bashrc"),
},
AliasEntry {
name: "ports".to_string(),
entry_type: EntryType::Alias,
value: "lsof -i -P -n | grep LISTEN".to_string(),
comments: Some(vec!["Show all listening ports on this machine".to_string()]),
source_file: PathBuf::from("~/.zshrc"),
},
// ── Functions ────────────────────────────────────────
AliasEntry {
name: "mkcd".to_string(),
entry_type: EntryType::Function,
value: "mkcd() {\n mkdir -p \"$1\"\n cd \"$1\"\n}".to_string(),
comments: Some(vec!["Create a directory and cd into it".to_string()]),
source_file: PathBuf::from("~/.zshrc"),
},
AliasEntry {
name: "extract".to_string(),
entry_type: EntryType::Function,
value: "extract() {\n # Check if file exists\n if [ -f \"$1\" ]; then\n case \"$1\" in\n *.tar.bz2) tar xjf \"$1\" ;;\n *.tar.gz) tar xzf \"$1\" ;;\n *.bz2) bunzip2 \"$1\" ;;\n *.rar) unrar x \"$1\" ;;\n *.gz) gunzip \"$1\" ;;\n *.tar) tar xf \"$1\" ;;\n *.tbz2) tar xjf \"$1\" ;;\n *.tgz) tar xzf \"$1\" ;;\n *.zip) unzip \"$1\" ;;\n *.Z) uncompress \"$1\" ;;\n *.7z) 7z x \"$1\" ;;\n *.deb) ar x \"$1\" ;;\n *.tar.xz) tar xJf \"$1\" ;;\n *.tar.zst) tar --use-compress-program=unzstd -xf \"$1\" ;;\n *) echo \"Error: '$1' cannot be extracted via extract()\" ;;\n esac\n else\n echo \"Error: '$1' is not a valid file\"\n fi\n}".to_string(),
comments: Some(vec![
"Extract various archive formats automatically".to_string(),
"".to_string(),
"This function intelligently detects the archive type based on file extension".to_string(),
"and uses the appropriate extraction tool. It saves you from remembering".to_string(),
"the specific flags and commands for each archive format.".to_string(),
"".to_string(),
"Supported formats:".to_string(),
" - tar.bz2, tar.gz, tar.xz, tar.zst (tarball variants)".to_string(),
" - bz2, gz, Z (compressed files)".to_string(),
" - zip, rar, 7z (archive files)".to_string(),
" - deb (Debian packages)".to_string(),
"".to_string(),
"Usage: extract <filename>".to_string(),
"Example: extract myarchive.tar.gz".to_string(),
]),
source_file: PathBuf::from("~/.bashrc"),
},
AliasEntry {
name: "gbr".to_string(),
entry_type: EntryType::Function,
value: "gbr() {\n git branch --sort=-committerdate\n}".to_string(),
comments: Some(vec!["List git branches sorted by last commit date".to_string()]),
source_file: PathBuf::from("~/.zshrc"),
},
AliasEntry {
name: "docker_cleanup".to_string(),
entry_type: EntryType::Function,
value: "docker_cleanup() {\n echo \"═══════════════════════════════════════════════\"\n echo \" Docker Cleanup Utility\"\n echo \"═══════════════════════════════════════════════\"\n echo \"\"\n \n echo \"📦 Step 1: Removing stopped containers...\"\n docker container prune -f\n echo \"✓ Done\"\n echo \"\"\n \n echo \"🖼️ Step 2: Removing dangling images...\"\n docker image prune -f\n echo \"✓ Done\"\n echo \"\"\n \n echo \"💾 Step 3: Removing unused volumes...\"\n docker volume prune -f\n echo \"✓ Done\"\n echo \"\"\n \n echo \"🌐 Step 4: Removing unused networks...\"\n docker network prune -f\n echo \"✓ Done\"\n echo \"\"\n \n echo \"═══════════════════════════════════════════════\"\n echo \"✨ Docker cleanup complete!\"\n echo \"═══════════════════════════════════════════════\"\n \n # Show remaining disk usage\n echo \"\"\n echo \"Current Docker disk usage:\"\n docker system df\n}".to_string(),
comments: Some(vec![
"Comprehensive Docker cleanup utility".to_string(),
"".to_string(),
"This function performs a thorough cleanup of your Docker environment by removing:".to_string(),
" 1. Stopped containers that are no longer needed".to_string(),
" 2. Dangling images (intermediate layers without tags)".to_string(),
" 3. Unused volumes that are not attached to any containers".to_string(),
" 4. Unused networks that are not referenced by any containers".to_string(),
"".to_string(),
"After cleanup, it displays current disk usage statistics to show how much".to_string(),
"space was reclaimed.".to_string(),
"".to_string(),
"⚠️ WARNING: This operation is destructive and cannot be undone!".to_string(),
"Make sure you don't have any important data in stopped containers or".to_string(),
"unnamed volumes before running this command.".to_string(),
"".to_string(),
"Usage: docker_cleanup".to_string(),
"".to_string(),
"For a dry-run to see what would be deleted, use:".to_string(),
" docker system prune --dry-run".to_string(),
]),
source_file: PathBuf::from("~/.stupidlylongsourcefilenamerc"),
},
AliasEntry {
name: "weather".to_string(),
entry_type: EntryType::Function,
value: "weather() {\n curl -s \"wttr.in/${1:-}\"\n}".to_string(),
comments: None,
source_file: PathBuf::from("~/.bashrc"),
},
AliasEntry {
name: "backup".to_string(),
entry_type: EntryType::Function,
value: "backup() {\n local src=\"$1\"\n local timestamp\n timestamp=$(date +%Y%m%d_%H%M%S)\n local dest=\"${src}.backup_${timestamp}\"\n cp -r \"$src\" \"$dest\"\n echo \"Backed up to: $dest\"\n}".to_string(),
comments: Some(vec![
"Create a timestamped backup of a file or directory".to_string(),
"Usage: backup <path>".to_string(),
]),
source_file: PathBuf::from("~/.zshrc"),
},
AliasEntry {
name: "git_stats".to_string(),
entry_type: EntryType::Function,
value: "git_stats() {\n echo \"═══════════════════════════════════════════════════════════════\"\n echo \" Git Repository Statistics\"\n echo \"═══════════════════════════════════════════════════════════════\"\n echo \"\"\n \n # Check if we're in a git repository\n if ! git rev-parse --git-dir > /dev/null 2>&1; then\n echo \"❌ Error: Not a git repository\"\n return 1\n fi\n \n # Repository info\n echo \"📁 Repository: $(basename \"$(git rev-parse --show-toplevel)\")\"\n echo \"🌿 Current branch: $(git branch --show-current)\"\n echo \"📍 Latest commit: $(git log -1 --pretty=format:'%h - %s')\"\n echo \"\"\n \n # Commit statistics\n echo \"📊 Commit Statistics:\"\n echo \" Total commits: $(git rev-list --count HEAD)\"\n echo \" Contributors: $(git shortlog -sn --all | wc -l | tr -d ' ')\"\n echo \"\"\n \n # Top contributors\n echo \"👥 Top 5 Contributors:\"\n git shortlog -sn --all --no-merges | head -5 | nl\n echo \"\"\n \n # File statistics\n echo \"📄 File Statistics:\"\n echo \" Total files: $(git ls-files | wc -l | tr -d ' ')\"\n echo \" Lines of code: $(git ls-files | xargs wc -l 2>/dev/null | tail -1 | awk '{print $1}')\"\n echo \"\"\n \n # Recent activity\n echo \"⏰ Recent Activity (last 7 days):\"\n echo \" Commits: $(git log --since='7 days ago' --oneline | wc -l | tr -d ' ')\"\n echo \" Files changed: $(git log --since='7 days ago' --name-only --pretty=format: | sort -u | wc -l | tr -d ' ')\"\n echo \"\"\n \n # Branch info\n echo \"🌳 Branch Information:\"\n echo \" Total branches: $(git branch -a | wc -l | tr -d ' ')\"\n echo \" Local branches: $(git branch | wc -l | tr -d ' ')\"\n echo \" Remote branches: $(git branch -r | wc -l | tr -d ' ')\"\n echo \"\"\n \n # Repository size\n echo \"💾 Repository Size:\"\n du -sh .git 2>/dev/null | awk '{print \" .git directory: \" $1}'\n echo \"\"\n \n echo \"═══════════════════════════════════════════════════════════════\"\n}".to_string(),
comments: Some(vec![
"Display comprehensive statistics about the current git repository".to_string(),
"".to_string(),
"This function provides a detailed overview of your git repository including:".to_string(),
"".to_string(),
"Repository Information:".to_string(),
" - Repository name and current branch".to_string(),
" - Latest commit hash and message".to_string(),
"".to_string(),
"Commit Statistics:".to_string(),
" - Total number of commits in the repository".to_string(),
" - Number of unique contributors".to_string(),
" - Top 5 contributors by commit count".to_string(),
"".to_string(),
"File Statistics:".to_string(),
" - Total number of tracked files".to_string(),
" - Total lines of code across all files".to_string(),
"".to_string(),
"Recent Activity:".to_string(),
" - Commits made in the last 7 days".to_string(),
" - Number of unique files changed recently".to_string(),
"".to_string(),
"Branch Information:".to_string(),
" - Total number of branches (local + remote)".to_string(),
" - Breakdown of local vs remote branches".to_string(),
"".to_string(),
"Repository Size:".to_string(),
" - Disk space used by the .git directory".to_string(),
"".to_string(),
"Usage: git_stats".to_string(),
"".to_string(),
"Note: Must be run from within a git repository directory.".to_string(),
]),
source_file: PathBuf::from("~/.zshrc"),
},
]
}