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`, PreRun: runCacheCmd, PostRun: postCacheCmd, Run: func(cmd *cobra.Command, args []string) { if conf.Dump.Full { fmt.Println(cache.DumpString(true, searchStringFromArgs(args))) } 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")) }