package app import ( "cnb.cool/looc/git-cnb/cnb" "cnb.cool/looc/git-cnb/ui" "context" "github.com/spf13/cobra" "os" "strconv" ) var LoginCmd = &cobra.Command{ Use: "info", Short: "print information of this repo", Long: "print information of this repo", Run: func(cmd *cobra.Command, args []string) { Info(cmd.Context()) }, } func Info(ctx context.Context) { repo, err := cnb.GetRepo(ctx, Client, Repo) if err != nil { ui.Error(err.Error()) os.Exit(0) } kvs := []ui.KV{ {K: "Name", V: repo.Path}, {K: "ID", V: strconv.FormatInt(repo.ID, 10)}, {K: "License", V: repo.License}, {K: "Topics", V: repo.Topics}, {K: "Stars", V: strconv.FormatUint(uint64(repo.Stars), 10)}, {K: "Forks", V: strconv.FormatUint(uint64(repo.Forks), 10)}, {K: "Description", V: repo.Description}, } ui.KVTable(kvs) }