From f3c3ce11a445ca7a925ed23d795e854f6b45f415 Mon Sep 17 00:00:00 2001 From: stephen mcquay Date: Sat, 3 Mar 2018 22:32:30 -0800 Subject: [PATCH] Meta can return their web location --- meta.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/meta.go b/meta.go index 7615464..9460e3e 100644 --- a/meta.go +++ b/meta.go @@ -2,6 +2,7 @@ package pm import ( "errors" + "fmt" "net/url" ) @@ -28,5 +29,14 @@ func (m Meta) Valid() (bool, error) { return true, nil } +// URL returns the http location of this package. +func (m Meta) URL() string { + return fmt.Sprintf("%s/%s-%s.pkg", m.Remote.String(), m.Name, m.Version) +} + +func (m Meta) String() string { + return m.URL() +} + // Metas is a slice of Meta type Metas []Meta