You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
cointop/cmd/commands/clean.go

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
}