2019-08-14 12:06:45 +00:00
|
|
|
package main
|
2016-07-27 17:38:10 +00:00
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
|
2016-07-27 21:15:49 +00:00
|
|
|
"github.com/gogits/go-gogs-client"
|
2016-07-27 17:38:10 +00:00
|
|
|
"github.com/spf13/cobra"
|
|
|
|
)
|
|
|
|
|
2016-07-27 22:06:32 +00:00
|
|
|
// 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",
|
2019-08-14 12:06:45 +00:00
|
|
|
Example: `
|
|
|
|
gogs repo new my-new-repo --private
|
|
|
|
gogs repo create my-new-repo --org=JustUsGuys
|
|
|
|
gogs repo list
|
|
|
|
gogs repo migrate ia/my-copy-cat https://github.com/gogits/gogs.git
|
|
|
|
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]")
|
|
|
|
// },
|
2016-07-27 17:38:10 +00:00
|
|
|
}
|
|
|
|
|
2016-07-27 21:15:49 +00:00
|
|
|
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
|
|
|
}
|
|
|
|
|
2019-08-14 12:06:45 +00:00
|
|
|
fmt.Println("| HTML: ", repo.HTMLURL)
|
|
|
|
fmt.Println("| SSH : ", repo.SSHURL)
|
|
|
|
fmt.Println("| GIT : ", repo.CloneURL)
|
2016-07-28 10:46:02 +00:00
|
|
|
fmt.Println()
|
2016-07-27 21:15:49 +00:00
|
|
|
}
|
2016-07-27 17:38:10 +00:00
|
|
|
|
2016-07-27 21:15:49 +00:00
|
|
|
func init() {
|
2016-07-27 22:06:32 +00:00
|
|
|
RootCmd.AddCommand(repoCmd)
|
2016-07-27 17:38:10 +00:00
|
|
|
}
|