Skip to content
This repository has been archived by the owner on Apr 23, 2024. It is now read-only.

Commit

Permalink
cmd: added cache-clear command (#14)
Browse files Browse the repository at this point in the history
  • Loading branch information
i582 authored Jun 30, 2021
1 parent 53fdf4e commit 8139b80
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
15 changes: 15 additions & 0 deletions cmd/cache_clear.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package cmd

import (
"fmt"
"os"
)

func CacheClear() (int, error) {
cacheDir := DefaultCacheDir()
if cacheDir == "/" || cacheDir == "" {
panic(fmt.Sprintf("attempted to rm -rf %s", cacheDir))
}
err := os.RemoveAll(cacheDir)
return 0, err
}
8 changes: 8 additions & 0 deletions cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,14 @@ func Main() {
},
})

app.Commands = append(app.Commands, &cmd.Command{
Name: "cache-clear",
Description: "The command clears the cache",
Action: func(ctx *cmd.AppContext) (int, error) {
return CacheClear()
},
})

app.Commands = append(app.Commands, &cmd.Command{
Name: "init",
Description: "The command to create a template palette in the project folder",
Expand Down

0 comments on commit 8139b80

Please sign in to comment.