gogs-cli/cmd/repo.go

53 lines
1.0 KiB
Go
Raw Normal View History

package cmd
import (
"fmt"
"github.com/gogits/go-gogs-client"
"github.com/spf13/cobra"
)
// repoCmd represents the repo command
var repoCmd = &cobra.Command{
2016-07-28 10:46:02 +00:00
Aliases: []string{"r"},
Use: "repo",
Short: "parent command for repositories",
2016-07-28 00:11:57 +00:00
Long: `gogs repo [(new|create)|list|destroy]
$ gogs repo new my-new-repo --private
$ gogs repo create my-new-repo --org=JustUsGuys
$ gogs repo list
$ gogs repo destroy ia my-new-repo
$ gogs repo destroy ia/my-new-repo
2016-07-28 00:11:57 +00:00
`,
2016-07-28 10:46:02 +00:00
// Run: func(cmd *cobra.Command, args []string) {
// fmt.Println("Please use: gogs repo [(new|create)|list|destroy]")
// },
}
func printRepo(repo *gogs.Repository) {
2016-07-28 10:46:02 +00:00
fmt.Println()
fmt.Printf("| * %v", repo.FullName)
2016-07-28 00:11:57 +00:00
if repo.Private {
fmt.Printf(" (private)")
}
if repo.Fork {
fmt.Printf(" (fork)")
}
2016-07-28 10:46:02 +00:00
fmt.Println("")
2016-07-28 00:11:57 +00:00
if repo.Description != "" {
2016-07-28 10:46:02 +00:00
fmt.Println("| --> ", repo.Description)
2016-07-28 00:11:57 +00:00
}
2016-07-28 10:46:02 +00:00
fmt.Println("| HTML: ", repo.HtmlUrl)
fmt.Println("| SSH : ", repo.SshUrl)
fmt.Println("| GIT : ", repo.CloneUrl)
fmt.Println()
}
func init() {
RootCmd.AddCommand(repoCmd)
}