pkger/path.go

25 lines
337 B
Go
Raw Normal View History

2019-07-31 00:21:26 +03:00
package pkger
import (
"fmt"
)
type Path struct {
2019-07-31 18:53:36 +03:00
Pkg string `json:"pkg"`
Name string `json:"name"`
2019-07-31 00:21:26 +03:00
}
func (p Path) String() string {
if len(p.Pkg) == 0 {
return p.Name
}
if len(p.Name) == 0 {
return p.Pkg
}
return fmt.Sprintf("%s:/%s", p.Pkg, p.Name)
}
func Parse(p string) (Path, error) {
2019-07-31 23:29:49 +03:00
return rootIndex.Parse(p)
2019-07-31 00:21:26 +03:00
}