29 lines
772 B
Go
29 lines
772 B
Go
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))
|
|
}
|