mirror of
https://github.com/tw93/Mole.git
synced 2026-02-10 21:49:16 +00:00
feat(windows): add Windows support Phase 3 - TUI tools
Add Go-based TUI tools for Windows: - cmd/analyze: Interactive disk space analyzer with Bubble Tea - cmd/status: Real-time system health monitor using gopsutil/WMI - bin/analyze.ps1: Wrapper script for analyze tool - bin/status.ps1: Wrapper script for status tool - Makefile: Build automation for Go tools - Updated README.md with Phase 3 documentation
This commit is contained in:
79
windows/bin/analyze.ps1
Normal file
79
windows/bin/analyze.ps1
Normal file
@@ -0,0 +1,79 @@
|
||||
# Mole - Analyze Command
|
||||
# Disk space analyzer wrapper
|
||||
|
||||
#Requires -Version 5.1
|
||||
param(
|
||||
[Parameter(Position = 0)]
|
||||
[string]$Path,
|
||||
[switch]$ShowHelp
|
||||
)
|
||||
|
||||
$ErrorActionPreference = "Stop"
|
||||
|
||||
# Script location
|
||||
$scriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path
|
||||
$windowsDir = Split-Path -Parent $scriptDir
|
||||
$binPath = Join-Path $windowsDir "bin\analyze.exe"
|
||||
|
||||
# Help
|
||||
function Show-AnalyzeHelp {
|
||||
$esc = [char]27
|
||||
Write-Host ""
|
||||
Write-Host "$esc[1;35mMole Analyze$esc[0m - Interactive disk space analyzer"
|
||||
Write-Host ""
|
||||
Write-Host "$esc[33mUsage:$esc[0m mole analyze [path]"
|
||||
Write-Host ""
|
||||
Write-Host "$esc[33mOptions:$esc[0m"
|
||||
Write-Host " [path] Path to analyze (default: user profile)"
|
||||
Write-Host " -ShowHelp Show this help message"
|
||||
Write-Host ""
|
||||
Write-Host "$esc[33mKeybindings:$esc[0m"
|
||||
Write-Host " Up/Down Navigate entries"
|
||||
Write-Host " Enter Enter directory"
|
||||
Write-Host " Backspace Go back"
|
||||
Write-Host " Space Multi-select"
|
||||
Write-Host " d Delete selected"
|
||||
Write-Host " f Toggle large files view"
|
||||
Write-Host " o Open in Explorer"
|
||||
Write-Host " r Refresh"
|
||||
Write-Host " q Quit"
|
||||
Write-Host ""
|
||||
}
|
||||
|
||||
if ($ShowHelp) {
|
||||
Show-AnalyzeHelp
|
||||
return
|
||||
}
|
||||
|
||||
# Check if binary exists
|
||||
if (-not (Test-Path $binPath)) {
|
||||
Write-Host "Building analyze tool..." -ForegroundColor Cyan
|
||||
|
||||
$cmdDir = Join-Path $windowsDir "cmd\analyze"
|
||||
$binDir = Join-Path $windowsDir "bin"
|
||||
|
||||
if (-not (Test-Path $binDir)) {
|
||||
New-Item -ItemType Directory -Path $binDir -Force | Out-Null
|
||||
}
|
||||
|
||||
Push-Location $windowsDir
|
||||
try {
|
||||
$result = & go build -o "$binPath" "./cmd/analyze/" 2>&1
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
Write-Host "Failed to build analyze tool: $result" -ForegroundColor Red
|
||||
Pop-Location
|
||||
return
|
||||
}
|
||||
}
|
||||
finally {
|
||||
Pop-Location
|
||||
}
|
||||
}
|
||||
|
||||
# Set path environment variable if provided
|
||||
if ($Path) {
|
||||
$env:MO_ANALYZE_PATH = $Path
|
||||
}
|
||||
|
||||
# Run the binary
|
||||
& $binPath
|
||||
73
windows/bin/status.ps1
Normal file
73
windows/bin/status.ps1
Normal file
@@ -0,0 +1,73 @@
|
||||
# Mole - Status Command
|
||||
# System status monitor wrapper
|
||||
|
||||
#Requires -Version 5.1
|
||||
param(
|
||||
[switch]$ShowHelp
|
||||
)
|
||||
|
||||
$ErrorActionPreference = "Stop"
|
||||
|
||||
# Script location
|
||||
$scriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path
|
||||
$windowsDir = Split-Path -Parent $scriptDir
|
||||
$binPath = Join-Path $windowsDir "bin\status.exe"
|
||||
|
||||
# Help
|
||||
function Show-StatusHelp {
|
||||
$esc = [char]27
|
||||
Write-Host ""
|
||||
Write-Host "$esc[1;35mMole Status$esc[0m - Real-time system health monitor"
|
||||
Write-Host ""
|
||||
Write-Host "$esc[33mUsage:$esc[0m mole status"
|
||||
Write-Host ""
|
||||
Write-Host "$esc[33mOptions:$esc[0m"
|
||||
Write-Host " -ShowHelp Show this help message"
|
||||
Write-Host ""
|
||||
Write-Host "$esc[33mDisplays:$esc[0m"
|
||||
Write-Host " - System health score (0-100)"
|
||||
Write-Host " - CPU usage and model"
|
||||
Write-Host " - Memory and swap usage"
|
||||
Write-Host " - Disk space per drive"
|
||||
Write-Host " - Top processes by CPU"
|
||||
Write-Host " - Network interfaces"
|
||||
Write-Host ""
|
||||
Write-Host "$esc[33mKeybindings:$esc[0m"
|
||||
Write-Host " c Toggle mole animation"
|
||||
Write-Host " r Force refresh"
|
||||
Write-Host " q Quit"
|
||||
Write-Host ""
|
||||
}
|
||||
|
||||
if ($ShowHelp) {
|
||||
Show-StatusHelp
|
||||
return
|
||||
}
|
||||
|
||||
# Check if binary exists
|
||||
if (-not (Test-Path $binPath)) {
|
||||
Write-Host "Building status tool..." -ForegroundColor Cyan
|
||||
|
||||
$cmdDir = Join-Path $windowsDir "cmd\status"
|
||||
$binDir = Join-Path $windowsDir "bin"
|
||||
|
||||
if (-not (Test-Path $binDir)) {
|
||||
New-Item -ItemType Directory -Path $binDir -Force | Out-Null
|
||||
}
|
||||
|
||||
Push-Location $windowsDir
|
||||
try {
|
||||
$result = & go build -o "$binPath" "./cmd/status/" 2>&1
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
Write-Host "Failed to build status tool: $result" -ForegroundColor Red
|
||||
Pop-Location
|
||||
return
|
||||
}
|
||||
}
|
||||
finally {
|
||||
Pop-Location
|
||||
}
|
||||
}
|
||||
|
||||
# Run the binary
|
||||
& $binPath
|
||||
Reference in New Issue
Block a user