Skip to content

Commit

Permalink
feat(cmd/ondrejsika/desktop_cleanup): Add --brew-cache cleanup param
Browse files Browse the repository at this point in the history
  • Loading branch information
ondrejsika committed Jun 17, 2024
1 parent 2bfd0cb commit f0c0a35
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions cmd/ondrejsika/desktop_cleanup/desktop_cleanup.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ var FlagYesGoBuildCache bool
var FlagYesGoPkgModCache bool
var FlagYesYarnCache bool
var FlagTerraformPluginDir bool
var FlagBrewCache bool

var ListSh []string
var ListRm []string
Expand All @@ -27,7 +28,6 @@ var Cmd = &cobra.Command{
Args: cobra.NoArgs,
Run: func(c *cobra.Command, args []string) {
// Prepare cleanup script
registerSh("brew cleanup")
dockerUp, _ := docker_utils.Ping()
if dockerUp {
registerSh("docker system prune --force")
Expand All @@ -40,7 +40,9 @@ var Cmd = &cobra.Command{
if FlagYesGoBuildCache {
registerRm("./Library/Caches/go-build/*")
}
registerRm("./Library/Caches/Homebrew/downloads/*")
if FlagBrewCache {
registerRm("./Library/Caches/Homebrew/*")
}
if FlagYesGoPkgModCache {
registerRm("./go/pkg/mod/cache/*")
}
Expand Down Expand Up @@ -107,6 +109,12 @@ func init() {
false,
"Remove Terraform providers Dir (rm -rf ~/terraform-plugin-cache/*)",
)
Cmd.Flags().BoolVar(
&FlagBrewCache,
"brew-cache",
false,
"Cleanup Brew cache (rm -rf ~/Library/Caches/Homebrew/*)",
)
}

func registerSh(s string) {
Expand Down

0 comments on commit f0c0a35

Please sign in to comment.