Package subcommand code

This commit is contained in:
2024-12-30 15:50:31 -05:00
parent 96378d047e
commit b9d7d5a4f2
51 changed files with 357 additions and 295 deletions

View File

@@ -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"))
}