1
0
forked from sm/vain
vain/vain.go
2016-02-13 00:17:12 -08:00

40 lines
574 B
Go

package vain
import "fmt"
type vcs int
const (
Git vcs = iota
Hg
)
var vcss = [...]string{
"git",
"mercurial",
}
var labelToVcs = map[string]vcs{
"git": Git,
"mercurial": Hg,
"hg": Hg,
}
// String returns the name of the vcs ("git", "mercurial", ...).
func (v vcs) String() string { return vcss[v] }
type Package struct {
Vcs vcs `json":vcs"`
Path string `json:"path"`
Repo string `json:"repo"`
}
func (p Package) String() string {
return fmt.Sprintf(
"<meta name=\"go-import\" content=\"%s %s %s\">",
p.Path,
p.Vcs,
p.Repo,
)
}