2
0
mirror of https://github.com/miguelmota/cointop synced 2024-11-14 18:12:57 +00:00
cointop/cmd/commands/clean.go
2020-11-18 20:37:40 -08:00

30 lines
675 B
Go

package cmd
import (
"github.com/miguelmota/cointop/cointop"
"github.com/miguelmota/cointop/pkg/filecache"
"github.com/spf13/cobra"
)
// CleanCmd ...
func CleanCmd() *cobra.Command {
cacheDir := filecache.DefaultCacheDir
cleanCmd := &cobra.Command{
Use: "clean",
Short: "Clear the cache",
Long: `The clean command clears the cache`,
RunE: func(cmd *cobra.Command, args []string) error {
// NOTE: if clean command, clean but don't run cointop
return cointop.Clean(&cointop.CleanConfig{
Log: true,
CacheDir: cacheDir,
})
},
}
cleanCmd.Flags().StringVarP(&cacheDir, "cache-dir", "", cacheDir, "Cache directory")
return cleanCmd
}