git-project-manager/cmd/project_list.go

28 lines
701 B
Go
Raw Normal View History

2023-12-10 04:19:19 +00:00
package cmd
import (
"fmt"
"github.com/spf13/cobra"
"github.com/spf13/viper"
)
var projectListCmd = &cobra.Command{
Use: "list",
Short: "List GitLab Projects",
2023-12-10 16:15:52 +00:00
Aliases: []string{"ls", "l"},
2023-12-10 04:19:19 +00:00
Long: projListCmdLong,
Run: projectListCmdRun,
}
func projectListCmdRun(cmd *cobra.Command, args []string) {
2024-10-01 18:29:14 +00:00
remotes := viper.GetStringSlice(FlagRemote)
fmt.Println(projectCache.DumpString(viper.GetBool(ViperProjectListAll), searchStringFromArgs(args), remotes...))
2023-12-10 04:19:19 +00:00
}
func init() {
projectCmd.AddCommand(projectListCmd)
2024-10-01 18:29:14 +00:00
projectListCmd.PersistentFlags().Bool(FlagAll, false, "List all, not just cloned locally")
viper.BindPFlag(ViperProjectListAll, projectListCmd.Flag(FlagAll))
2023-12-10 04:19:19 +00:00
}