fix: re-structure update check

Signed-off-by: jolheiser <john.olheiser@gmail.com>
main
jolheiser 2023-01-30 22:04:33 -06:00
parent dd84c45c71
commit 3bccb54f54
Signed by: jolheiser
GPG Key ID: B853ADA5DA7BBF7A
1 changed files with 11 additions and 3 deletions

14
main.go
View File

@ -56,10 +56,18 @@ func main() {
}
uri := fs.Arg(0)
if *updateFlag && strings.Index(uri, "/") == -1 {
if pkg, ok := m.Packages[uri]; ok {
uri = pkg.Repo
if strings.Index(uri, "/") != -1 {
if !*updateFlag {
fmt.Println("provided arg must be a URI, unless using --update")
return
}
pkg, ok := m.Packages[uri]
if !ok {
fmt.Println("arg was not a URI and didn't match an installed package")
return
}
uri = pkg.Repo
}
f, err = forge.NewGitea(uri)