commands

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: May 17, 2026 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DiskUsageBarWidth is the width of the disk usage bar in characters.
	DiskUsageBarWidth = 15
	// BytesThresholdGB is the threshold for displaying GB freed message.
	BytesThresholdGB = 1_000_000_000
	// BytesThresholdMB is the threshold for displaying MB freed message.
	BytesThresholdMB = 100_000_000
)
View Source
const (
	ProfileFormatText  = "text"
	ProfileFormatJSON  = "json"
	ProfileFormatEmoji = "emoji"
)

Variables

View Source
var (
	ErrNoCleanersAvailable  = errors.New("no cleaners available on this system")
	ErrNoConfigPathProvided = errors.New("no config path provided")
)

Sentinel errors for clean command.

View Source
var (
	ErrProfileNotFound   = errors.New("profile not found")
	ErrProfileNoCleaners = errors.New("profile has no available cleaners")
)

Sentinel errors for clean_select.

View Source
var (
	ErrUnknownCleanerType = errors.New("unknown cleaner type")
	ErrNixNotAvailable    = errors.New("nix not available on this system")
	ErrGoProcessesRunning = errors.New("other Go processes detected")
)

Sentinel errors for cleaner_implementations.

View Source
var (
	ErrNoGitRepositoriesFound = errors.New("no git repositories found")
	ErrGitNotAvailable        = errors.New("not a git repository or git not available")
	ErrSafetyChecksFailed     = errors.New("safety checks failed")
	ErrNotAGitRepository      = errors.New("not a git repository")
)

Sentinel errors for git history operations.

View Source
var (
	TitleStyle = lipgloss.NewStyle().
				Bold(true).
				Foreground(lipgloss.Color("86")).
				Padding(1, 0)

	WarningStyle = lipgloss.NewStyle().
					Foreground(lipgloss.Color("214")).
					Padding(0, 1)

	InfoStyle = lipgloss.NewStyle().
				Foreground(lipgloss.Color("117")).
				Padding(0, 1)

	SuccessStyle = lipgloss.NewStyle().
					Foreground(lipgloss.Color("82")).
					Padding(0, 1)

	ErrorStyle = lipgloss.NewStyle().
				Foreground(lipgloss.Color("196")).
				Padding(0, 1)

	HeaderStyle = lipgloss.NewStyle().
				Bold(true).
				Foreground(lipgloss.Color("81")).
				Padding(0, 1)

	MutedStyle = lipgloss.NewStyle().
				Foreground(lipgloss.Color("241")).
				Padding(0, 1)
)

Functions

func GetDefaultConfig

func GetDefaultConfig() *domain.Config

GetDefaultConfig returns the default configuration. This is a wrapper around config.GetDefaultConfig for use in commands.

func NewCleanCommand

func NewCleanCommand() *cobra.Command

NewCleanCommand creates a multi-cleaner command with TUI.

func NewConfigCommand

func NewConfigCommand() *cobra.Command

NewConfigCommand creates a configuration management command.

func NewConfigEditCommand

func NewConfigEditCommand() *cobra.Command

NewConfigEditCommand creates a command to edit the configuration.

func NewConfigResetCommand

func NewConfigResetCommand() *cobra.Command

NewConfigResetCommand creates a command to reset the configuration.

func NewConfigShowCommand

func NewConfigShowCommand() *cobra.Command

NewConfigShowCommand creates a command to show the configuration.

func NewConfigValidateCommand

func NewConfigValidateCommand() *cobra.Command

NewConfigValidateCommand creates a command to validate the configuration.

func NewGitHistoryCommand

func NewGitHistoryCommand() *cobra.Command

NewGitHistoryCommand creates the git-history subcommand.

func NewInitCommand

func NewInitCommand() *cobra.Command

NewInitCommand creates an interactive setup wizard command.

func NewProfileCommand

func NewProfileCommand() *cobra.Command

NewProfileCommand creates a profile management command.

func NewProfileCreateCommand

func NewProfileCreateCommand() *cobra.Command

NewProfileCreateCommand creates a command to create a new profile.

func NewProfileDeleteCommand

func NewProfileDeleteCommand() *cobra.Command

NewProfileDeleteCommand creates a command to delete a profile.

func NewProfileListCommand

func NewProfileListCommand() *cobra.Command

NewProfileListCommand creates a command to list all profiles.

func NewProfileShowCommand

func NewProfileShowCommand() *cobra.Command

NewProfileShowCommand creates a command to show profile details.

func NewRootCmd

func NewRootCmd() *cobra.Command

NewRootCmd creates the root command.

func NewScanCommand

func NewScanCommand() *cobra.Command

NewScanCommand creates a command that scans for cleanable items.

func PrintProfileSummaries

func PrintProfileSummaries(profiles any, format string)

Types

type CleanerAvailability

type CleanerAvailability string

CleanerAvailability represents the availability status of a cleaner.

const (
	CleanerAvailabilityAvailable   CleanerAvailability = "available"
	CleanerAvailabilityUnavailable CleanerAvailability = "unavailable"
)

type CleanerConfig

type CleanerConfig struct {
	Type        CleanerType
	Name        string
	Description string
	Icon        string
	Available   CleanerAvailability
}

CleanerConfig holds configuration for each cleaner type.

func GetCleanerConfigs

func GetCleanerConfigs(ctx context.Context) []CleanerConfig

GetCleanerConfigs returns all cleaner configurations with availability status. Uses the CleanerRegistry for dynamic discovery and availability checking. Returns an empty slice if the registry cannot be created.

type CleanerType

type CleanerType string

CleanerType represents available cleaner types for TUI selection.

const (
	CleanerTypeNix                          CleanerType = "nix"
	CleanerTypeHomebrew                     CleanerType = "homebrew"
	CleanerTypeTempFiles                    CleanerType = "tempfiles"
	CleanerTypeNodePackages                 CleanerType = "node"
	CleanerTypeGoPackages                   CleanerType = "go"
	CleanerTypeCargoPackages                CleanerType = "cargo"
	CleanerTypeBuildCache                   CleanerType = "buildcache"
	CleanerTypeDocker                       CleanerType = "docker"
	CleanerTypeSystemCache                  CleanerType = "systemcache"
	CleanerTypeProjectsManagementAutomation CleanerType = "projects"
	CleanerTypeCompiledBinaries             CleanerType = "compiled-binaries"
	CleanerTypeProjectExecutables           CleanerType = "project-executables"
	CleanerTypeGolangciLintCache            CleanerType = "golangci-lint-cache"
)

type ScanDisplay

type ScanDisplay struct {
	RepoPath   string
	Files      []domain.GitHistoryFile
	TotalBytes int64
	TotalFiles int
	RepoSize   int64
	Duration   time.Duration
}

ScanDisplay holds formatted scan results.

func ScanRepoForDisplay

func ScanRepoForDisplay(ctx context.Context, repoPath string, minSizeMB int) (*ScanDisplay, error)

ScanRepoForDisplay is a helper to get scan results formatted for display.

type ScanResult

type ScanResult struct {
	Name           string
	Available      CleanerAvailability
	ItemsCount     uint
	BytesCleanable uint64
	Description    string
	Icon           string
}

ScanResult holds the scan result for a cleaner.

Jump to

Keyboard shortcuts

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