git-project-manager/cmd/cache_dump.go
2023-12-09 23:19:19 -05:00

28 lines
550 B
Go

package cmd
import (
"fmt"
"github.com/spf13/cobra"
"github.com/spf13/viper"
)
var dumpCmd = &cobra.Command{
Use: "dump",
Short: "Dump GitLab project cache",
Long: `Dumps cache to display`,
Run: func(cmd *cobra.Command, args []string) {
if conf.Dump.Full {
fmt.Println(cache.DumpString(true))
} else {
plog.Info(cache.String())
}
},
}
func init() {
cacheCmd.AddCommand(dumpCmd)
dumpCmd.PersistentFlags().BoolP("full", "f", false, "Dumps entire cache")
viper.BindPFlag("dump.full", dumpCmd.LocalFlags().Lookup("full"))
}