Package subcommand code
This commit is contained in:
28
cmd/project/project_list.go
Normal file
28
cmd/project/project_list.go
Normal file
@@ -0,0 +1,28 @@
|
||||
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))
|
||||
}
|
||||
Reference in New Issue
Block a user