feat: update from name

Signed-off-by: jolheiser <john.olheiser@gmail.com>
main
jolheiser 2023-01-14 21:36:47 -06:00
parent 11f2017bff
commit 1ab01e3d8c
Signed by: jolheiser
GPG Key ID: B853ADA5DA7BBF7A
1 changed files with 10 additions and 4 deletions

14
main.go
View File

@ -43,8 +43,18 @@ func main() {
var f forge.Forger
var err error
m, err := meta.Read()
if err != nil {
panic(err)
}
uri := fs.Arg(0)
if *updateFlag && strings.Index(uri, "/") == -1 {
if pkg, ok := m.Packages[uri]; ok {
uri = pkg.Repo
}
}
f, err = forge.NewGitea(uri)
if strings.HasPrefix(uri, "github") {
f, err = forge.NewGitHub(uri)
@ -71,10 +81,6 @@ func main() {
}
if *updateFlag {
m, err := meta.Read()
if err != nil {
panic(err)
}
if strings.EqualFold(asset.Version, m.Packages[name].Version) {
fmt.Printf("%q is up-to-date\n", name)
return