Help us shape the future of Go! Take the 2026 Go Developer Survey

clean

package
v1.65.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 21, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CleanCmd = &cobra.Command{
	Use:     "clean",
	Aliases: []string{"cleanup", "prune", "c"},
	Short:   "Clean and reclaim host system storage across OS and developer tools",
	Long: `Orchestrates cross-platform system maintenance across macOS, Ubuntu, Fedora, and Debian/Raspberry Pi.

Cleans package manager caches (APT/DNF/Brew), vacuums systemd journal logs, prunes Docker container and image layers, and cleans outdated asdf tool versions.

Use the --dry-run (-n) flag to preview operations without modifying system data.
Use the --yes (-y) flag to run all available cleanup operations without prompting.`,
	RunE: func(cmd *cobra.Command, _args []string) error {
		headerStyle := lipgloss.NewStyle().
			Bold(true).
			Foreground(theme.Primary).
			MarginBottom(1)
		if !ui.DisableProgress {
			fmt.Fprintln(log.Out, headerStyle.Render("🧹 Host & System Storage Maintenance"))
		}

		isVerbose := cmdutil.IsVerbose(cmd)

		opts := cleanup.SystemCleanOptions{
			Docker: dockerFlagCleanSys,
			DockerOpts: cleanup.DockerCleanOptions{
				All:        allImagesFlagCleanSys,
				OlderThan:  olderThanFlagCleanSys,
				BuildCache: true,
				Volumes:    false,
				DryRun:     dryRunFlagCleanSys,
				Verbose:    isVerbose,
			},
			Journal:        journalFlagCleanSys,
			JournalSize:    journalSizeCleanSys,
			Packages:       packagesFlagCleanSys,
			Asdf:           asdfFlagCleanSys,
			Brew:           brewFlagCleanSys,
			DryRun:         dryRunFlagCleanSys,
			Verbose:        isVerbose,
			AutoApprove:    yesFlagCleanSys,
			CleanupTimeout: timeoutFlagCleanSys,
		}

		report, err := cleanup.RunSystemCleanup(opts)
		if err != nil {
			return err
		}

		if report != nil {
			summary := report.RenderSummaryTable()
			if summary != "" {
				fmt.Fprintln(log.Out, summary)
			}
		}

		return nil
	},
}

CleanCmd represents the system clean command.

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL