git-project-manager/cmd/project/project_list.go

29 lines
772 B
Go
Raw Permalink Normal View History

2024-12-30 20:50:31 +00:00
package project
import (
"fmt"
"github.com/spf13/cobra"
"github.com/spf13/viper"
"gitea.libretechconsulting.com/rmcguire/git-project-manager/cmd/util"
)
var projectListCmd = &cobra.Command{
Use: "list",
Short: "List Git Projects",
Aliases: []string{"ls", "l"},
Long: util.ProjListCmdLong,
Run: projectListCmdRun,
}
func projectListCmdRun(cmd *cobra.Command, args []string) {
remotes := viper.GetStringSlice(util.FlagRemote)
fmt.Println(utils.Cache().DumpString(viper.GetBool(util.ViperProjectListAll), utils.SearchStringFromArgs(args), remotes...))
}
func init() {
projectListCmd.PersistentFlags().Bool(util.FlagAll, false, "List all, not just cloned locally")
viper.BindPFlag(util.ViperProjectListAll, projectListCmd.Flag(util.FlagAll))
}