@@ -16,28 +16,77 @@ import (
1616)
1717
1818var (
19- dryRun bool
20- confirmFlag bool
21- cleanIOS bool
22- cleanAndroid bool
23- cleanNode bool
24- useTUI bool
19+ dryRun bool
20+ confirmFlag bool
21+ cleanIOS bool
22+ cleanAndroid bool
23+ cleanNode bool
24+ cleanFlutter bool
25+ cleanPython bool
26+ cleanRust bool
27+ cleanGo bool
28+ cleanHomebrew bool
29+ cleanDocker bool
30+ cleanJava bool
31+ useTUI bool
2532)
2633
2734// cleanCmd represents the clean command
2835var cleanCmd = & cobra.Command {
29- Use : "clean" ,
36+ Use : "clean [flags] " ,
3037 Short : "Clean development artifacts" ,
3138 Long : `Interactively select and clean development artifacts.
3239
33- By default, runs in TUI mode with interactive selection.
34- Use --confirm to actually delete files (default is dry-run).
40+ By default, runs in TUI mode with interactive selection and dry-run
41+ enabled (preview only). Use --confirm to actually delete files.
42+
43+ The TUI provides:
44+ • Real-time deletion progress with package-manager style output
45+ • Tree navigation for exploring nested folders
46+ • Quick single-item cleanup or batch operations
47+ • All operations logged to ~/.dev-cleaner.log
48+
49+ Safety Features:
50+ ✓ Dry-run mode by default (files are safe)
51+ ✓ Confirmation required before deletion
52+ ✓ Path validation (never touches system files)
53+ ✓ All actions logged for audit trail
3554
3655Examples:
37- dev-cleaner clean # Interactive TUI (dry-run)
38- dev-cleaner clean --confirm # Interactive TUI (actually delete)
39- dev-cleaner clean --no-tui # Simple text mode
40- dev-cleaner clean --ios # Clean iOS artifacts only` ,
56+ dev-cleaner clean # Interactive TUI (dry-run)
57+ dev-cleaner clean --confirm # Interactive TUI (actually delete)
58+ dev-cleaner clean --no-tui # Simple text mode
59+ dev-cleaner clean --ios --confirm # Clean iOS artifacts only
60+ dev-cleaner clean --node # Preview Node.js cleanup (dry-run)
61+
62+ Flags:
63+ --confirm Actually delete files (disables dry-run)
64+ --dry-run Preview only, don't delete (default: true)
65+ --ios Clean iOS/Xcode artifacts only
66+ --android Clean Android/Gradle artifacts only
67+ --node Clean Node.js artifacts only
68+ --flutter Clean Flutter/Dart artifacts only
69+ --python Clean Python caches
70+ --rust Clean Rust/Cargo caches
71+ --go Clean Go caches
72+ --homebrew Clean Homebrew caches
73+ --docker Clean Docker images, containers, volumes
74+ --java Clean Maven/Gradle caches
75+ --no-tui, -T Disable TUI, use simple text mode
76+ --tui Use interactive TUI mode (default: true)
77+
78+ TUI Keyboard Shortcuts:
79+ c Quick clean current item (ignores selections)
80+ Enter Clean all selected items (batch mode)
81+ Space Toggle selection
82+ a/n Select all / none
83+ →/l Enter tree mode (explore folders)
84+ ? Show help screen
85+
86+ Important:
87+ • 'c' clears all selections and cleans ONLY the current item
88+ • 'Enter' cleans ALL selected items (batch operation)
89+ • Tree mode allows deletion at any folder level` ,
4190 Run : runClean ,
4291}
4392
@@ -49,6 +98,13 @@ func init() {
4998 cleanCmd .Flags ().BoolVar (& cleanIOS , "ios" , false , "Clean iOS/Xcode artifacts only" )
5099 cleanCmd .Flags ().BoolVar (& cleanAndroid , "android" , false , "Clean Android/Gradle artifacts only" )
51100 cleanCmd .Flags ().BoolVar (& cleanNode , "node" , false , "Clean Node.js artifacts only" )
101+ cleanCmd .Flags ().BoolVar (& cleanFlutter , "flutter" , false , "Clean Flutter/Dart artifacts only" )
102+ cleanCmd .Flags ().BoolVar (& cleanPython , "python" , false , "Clean Python caches" )
103+ cleanCmd .Flags ().BoolVar (& cleanRust , "rust" , false , "Clean Rust/Cargo caches" )
104+ cleanCmd .Flags ().BoolVar (& cleanGo , "go" , false , "Clean Go caches" )
105+ cleanCmd .Flags ().BoolVar (& cleanHomebrew , "homebrew" , false , "Clean Homebrew caches" )
106+ cleanCmd .Flags ().BoolVar (& cleanDocker , "docker" , false , "Clean Docker images, containers, volumes" )
107+ cleanCmd .Flags ().BoolVar (& cleanJava , "java" , false , "Clean Maven/Gradle caches" )
52108 cleanCmd .Flags ().BoolVar (& useTUI , "tui" , true , "Use interactive TUI mode (default)" )
53109 cleanCmd .Flags ().BoolP ("no-tui" , "T" , false , "Disable TUI, use simple text mode" )
54110}
@@ -76,14 +132,23 @@ func runClean(cmd *cobra.Command, args []string) {
76132 MaxDepth : 3 ,
77133 }
78134
79- if cleanIOS || cleanAndroid || cleanNode {
135+ specificFlagSet := cleanIOS || cleanAndroid || cleanNode || cleanFlutter ||
136+ cleanPython || cleanRust || cleanGo || cleanHomebrew ||
137+ cleanDocker || cleanJava
138+
139+ if specificFlagSet {
80140 opts .IncludeXcode = cleanIOS
81141 opts .IncludeAndroid = cleanAndroid
82142 opts .IncludeNode = cleanNode
143+ opts .IncludeFlutter = cleanFlutter
144+ opts .IncludePython = cleanPython
145+ opts .IncludeRust = cleanRust
146+ opts .IncludeGo = cleanGo
147+ opts .IncludeHomebrew = cleanHomebrew
148+ opts .IncludeDocker = cleanDocker
149+ opts .IncludeJava = cleanJava
83150 } else {
84- opts .IncludeXcode = true
85- opts .IncludeAndroid = true
86- opts .IncludeNode = true
151+ opts = types .DefaultScanOptions ()
87152 }
88153
89154 ui .PrintHeader ("Scanning for development artifacts..." )
@@ -104,7 +169,7 @@ func runClean(cmd *cobra.Command, args []string) {
104169
105170 // Use TUI or simple mode
106171 if useTUI {
107- if err := tui .Run (results , dryRun ); err != nil {
172+ if err := tui .Run (results , dryRun , Version ); err != nil {
108173 fmt .Fprintf (os .Stderr , "TUI error: %v\n " , err )
109174 os .Exit (1 )
110175 }
0 commit comments