Repository navigation
Expand file tree
/
Copy pathmain.go
More file actions
64 lines (56 loc) · 1.74 KB
/
Copy pathmain.go
File metadata and controls
64 lines (56 loc) · 1.74 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
package main
import (
"fmt"
"os"
"github.com/Nur-Adnan/duster/cmd"
"github.com/spf13/cobra"
)
// Version metadata — injected at build time via ldflags:
//
// go build -ldflags="-X main.Version=1.0.2 -X main.BuildDate=2026-05-20 -X main.Commit=abc1234"
var (
Version = "1.4.0"
BuildDate = "2026-05-20"
Commit = "dev"
)
var rootCmd = &cobra.Command{
Use: "du",
Short: "Duster — Deep clean and optimize your Windows PC.",
Long: `Duster (du) is a powerful, Windows-native command-line cleaning
and optimization utility designed to reclaim disk space, uninstall software remnants,
and improve overall system responsiveness.`,
Version: fmt.Sprintf("%s (built %s, commit %s)", Version, BuildDate, Commit),
Run: func(cmdCobra *cobra.Command, args []string) {
cmd.ExecuteLanding()
},
}
func init() {
// Wire version into the cmd package so subcommands can reference it
cmd.AppVersion = Version
// Configure root version flag
rootCmd.SetVersionTemplate("Duster version {{.Version}}\n")
// Wire all subcommands from the cmd package
rootCmd.AddCommand(cmd.CleanCmd)
rootCmd.AddCommand(cmd.UninstallCmd)
rootCmd.AddCommand(cmd.OptimizeCmd)
rootCmd.AddCommand(cmd.AnalyzeCmd)
rootCmd.AddCommand(cmd.StatusCmd)
rootCmd.AddCommand(cmd.PurgeCmd)
rootCmd.AddCommand(cmd.InstallerCmd)
rootCmd.AddCommand(cmd.VdiskCmd)
rootCmd.AddCommand(cmd.ScheduleCmd)
rootCmd.AddCommand(cmd.RestoreCmd)
rootCmd.AddCommand(cmd.UpdateCmd)
rootCmd.AddCommand(cmd.RemoveCmd)
rootCmd.AddCommand(cmd.DoctorCmd)
rootCmd.AddCommand(cmd.BenchmarkCmd)
rootCmd.AddCommand(cmd.VerifyCmd)
rootCmd.AddCommand(cmd.EngineCmd)
cmd.SetupCustomHelp(rootCmd)
}
func main() {
if err := rootCmd.Execute(); err != nil {
fmt.Fprintf(os.Stderr, "Error: %v\n", err)
os.Exit(1)
}
}