git-project-manager/cmd/cache_dump.go
Ryan McGuire b944af140a Add multi-remote support for GitLab (#1)
Co-authored-by: Ryan D McGuire <ryand_mcguire@sweetwater.com>
Reviewed-on: 50W/git-project-manager#1
2024-01-14 15:33:15 +00:00

30 lines
631 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`,
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"))
}