From 3bccb54f54d1d3fdb6608e6acea52f2884bff935 Mon Sep 17 00:00:00 2001 From: jolheiser Date: Mon, 30 Jan 2023 22:04:33 -0600 Subject: [PATCH] fix: re-structure update check Signed-off-by: jolheiser --- main.go | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/main.go b/main.go index c873020..f5abb65 100644 --- a/main.go +++ b/main.go @@ -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)