Meta can return their web location

This commit is contained in:
Stephen McQuay 2018-03-03 22:32:30 -08:00
parent 570c0d885f
commit f3c3ce11a4
Signed by untrusted user: sm
GPG Key ID: 4E4B72F479BA3CE5

10
meta.go
View File

@ -2,6 +2,7 @@ package pm
import ( import (
"errors" "errors"
"fmt"
"net/url" "net/url"
) )
@ -28,5 +29,14 @@ func (m Meta) Valid() (bool, error) {
return true, nil 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 // Metas is a slice of Meta
type Metas []Meta type Metas []Meta