Skip to content

Commit 247be7d

Browse files
committed
feat: Add comprehensive TUI enhancements with status bar, scanning animation, and version display
Implement three major TUI improvements to enhance user experience: 1. **Unified Status Bar Across All States** - Dynamic left/center/right layout with auto-width adjustment - State-specific information display (scanning progress, selected items, time tracking) - Real-time updates showing session duration and operation time - Consistent styling with primary purple color scheme 2. **Animated Scanning Progress** - StateScanning phase with package-manager-style loading animation - Category-by-category scanning display (✓ Complete, ⠋ Scanning..., ○ Pending) - 600ms interval progression through Xcode, Android, Node.js, Flutter - Smooth transition to StateSelecting after completion 3. **Version Display in Title** - Show application version in TUI title bar - Format: "🧹 Mac Dev Cleaner v{version}" - Pass version as parameter to avoid import cycles - Maintain [DRY-RUN] indicator when applicable **Technical Implementation:** - Added Model fields: startTime, deleteStart, scanningCategories, scanComplete, currentScanning, version - Created renderStatusBar() method handling 5 different states - Implemented tickScanning() for timed scanning progression - Fixed import cycle by passing version as parameter through tui.Run() - Updated both scan.go and clean.go to pass Version parameter **Status Bar Sections:** - Left: State indicator (🔍 Scanning, 📋 Select items, ⚠️ Confirm, 🗑️ Deleting, ✅ Done) - Center: Context info (progress %, selected count, operation status) - Right: Hints (keyboard shortcuts) or elapsed time **Files Modified:** - internal/tui/tui.go: Core TUI enhancements (150+ lines added) - cmd/root/scan.go: Pass version to tui.Run() - cmd/root/clean.go: Pass version to tui.Run() Tested with real Flutter projects: Successfully scanned 21 items (32.4 GB) including 10 Flutter items (7.0 GB)
1 parent 9212e04 commit 247be7d

File tree

3 files changed

+319
-21
lines changed

3 files changed

+319
-21
lines changed

cmd/root/clean.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ func runClean(cmd *cobra.Command, args []string) {
108108

109109
// Use TUI or simple mode
110110
if useTUI {
111-
if err := tui.Run(results, dryRun); err != nil {
111+
if err := tui.Run(results, dryRun, Version); err != nil {
112112
fmt.Fprintf(os.Stderr, "TUI error: %v\n", err)
113113
os.Exit(1)
114114
}

cmd/root/scan.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ func runScan(cmd *cobra.Command, args []string) {
9898

9999
// Launch TUI by default
100100
if scanTUI {
101-
if err := tui.Run(results, false); err != nil {
101+
if err := tui.Run(results, false, Version); err != nil {
102102
fmt.Fprintf(os.Stderr, "Error running TUI: %v\n", err)
103103
os.Exit(1)
104104
}

0 commit comments

Comments
 (0)