git-project-manager/cmd/cache_dump.go

28 lines
550 B
Go
Raw Normal View History

2023-12-04 21:53:01 +00:00
package cmd
import (
"fmt"
"github.com/spf13/cobra"
2023-12-08 21:52:26 +00:00
"github.com/spf13/viper"
2023-12-04 21:53:01 +00:00
)
var dumpCmd = &cobra.Command{
Use: "dump",
2023-12-07 17:08:56 +00:00
Short: "Dump GitLab project cache",
Long: `Dumps cache to display`,
2023-12-04 21:53:01 +00:00
Run: func(cmd *cobra.Command, args []string) {
2023-12-08 21:52:26 +00:00
if conf.Dump.Full {
2023-12-10 04:19:19 +00:00
fmt.Println(cache.DumpString(true))
2023-12-08 21:52:26 +00:00
} else {
plog.Info(cache.String())
}
2023-12-04 21:53:01 +00:00
},
}
func init() {
cacheCmd.AddCommand(dumpCmd)
2023-12-08 21:52:26 +00:00
dumpCmd.PersistentFlags().BoolP("full", "f", false, "Dumps entire cache")
viper.BindPFlag("dump.full", dumpCmd.LocalFlags().Lookup("full"))
2023-12-04 21:53:01 +00:00
}