Package subcommand code
This commit is contained in:
13
cmd/cache/cache_dump.go
vendored
13
cmd/cache/cache_dump.go
vendored
@@ -1,10 +1,12 @@
|
||||
package cmd
|
||||
package cache
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
"github.com/spf13/viper"
|
||||
|
||||
"gitea.libretechconsulting.com/rmcguire/git-project-manager/cmd/util"
|
||||
)
|
||||
|
||||
var dumpCmd = &cobra.Command{
|
||||
@@ -17,16 +19,15 @@ var dumpCmd = &cobra.Command{
|
||||
}
|
||||
|
||||
func runCacheDunpCmd(cmd *cobra.Command, args []string) {
|
||||
remotes := viper.GetStringSlice(FlagRemote)
|
||||
if conf.Dump.Full {
|
||||
fmt.Println(projectCache.DumpString(true, searchStringFromArgs(args), remotes...))
|
||||
remotes := viper.GetStringSlice(util.FlagRemote)
|
||||
if utils.Config().Dump.Full {
|
||||
fmt.Println(utils.Cache().DumpString(true, utils.SearchStringFromArgs(args), remotes...))
|
||||
} else {
|
||||
plog.Info(projectCache.String())
|
||||
utils.Logger().Info(utils.Cache().String())
|
||||
}
|
||||
}
|
||||
|
||||
func init() {
|
||||
cacheCmd.AddCommand(dumpCmd)
|
||||
dumpCmd.PersistentFlags().BoolP("full", "f", false, "Dumps entire cache")
|
||||
viper.BindPFlag("dump.full", dumpCmd.LocalFlags().Lookup("full"))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user