git-project-manager/cmd/project_list.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

28 lines
695 B
Go

package cmd
import (
"fmt"
"github.com/spf13/cobra"
"github.com/spf13/viper"
)
var projectListCmd = &cobra.Command{
Use: "list",
Short: "List GitLab Projects",
Aliases: []string{"ls", "l"},
Long: projListCmdLong,
Run: projectListCmdRun,
}
func projectListCmdRun(cmd *cobra.Command, args []string) {
gitlabs := viper.GetStringSlice("project.gitlabs")
fmt.Println(cache.DumpString(viper.GetBool("project.list.all"), searchStringFromArgs(args), gitlabs...))
}
func init() {
projectCmd.AddCommand(projectListCmd)
projectListCmd.PersistentFlags().Bool("all", false, "List all, not just cloned locally")
viper.BindPFlag("project.list.all", projectListCmd.Flag("all"))
}