Added flag for github username.

This commit is contained in:
alexkappa 2014-07-01 21:04:26 +02:00
parent 8f273bbc21
commit 76c15c68ce

View File

@ -15,11 +15,12 @@ import (
"time" "time"
) )
var domainFlag = flag.String("domain", "gopkg.in", "The domain in which this app is used")
var httpFlag = flag.String("http", ":8080", "Serve HTTP at given address") var httpFlag = flag.String("http", ":8080", "Serve HTTP at given address")
var httpsFlag = flag.String("https", "", "Serve HTTPS at given address") var httpsFlag = flag.String("https", "", "Serve HTTPS at given address")
var certFlag = flag.String("cert", "", "Use the provided TLS certificate") var certFlag = flag.String("cert", "", "Use the provided TLS certificate")
var keyFlag = flag.String("key", "", "Use the provided TLS key") var keyFlag = flag.String("key", "", "Use the provided TLS key")
var domainFlag = flag.String("domain", "gopkg.in", "Domain name")
var githubFlag = flag.String("github", "", "Github username")
func main() { func main() {
if err := run(); err != nil { if err := run(); err != nil {
@ -80,6 +81,9 @@ type Repo struct {
// GitHubRoot returns the repository root at GitHub, without a schema. // GitHubRoot returns the repository root at GitHub, without a schema.
func (repo *Repo) GitHubRoot() string { func (repo *Repo) GitHubRoot() string {
if *githubFlag != "" {
return "github.com/" + *githubFlag + "/" + repo.Name
}
if repo.User == "" { if repo.User == "" {
return "github.com/go-" + repo.Name + "/" + repo.Name return "github.com/go-" + repo.Name + "/" + repo.Name
} else { } else {