github.com/tooploox/oya@v0.0.21-0.20230524103240-1cda1861aad6/pkg/repo/open.go (about)

     1  package repo
     2  
     3  import "github.com/tooploox/oya/pkg/types"
     4  
     5  // Open opens a library containing all versions of a single Oya pack.
     6  func Open(importPath types.ImportPath) (*GithubRepo, error) {
     7  	if importPath.Host() != types.HostGithub {
     8  		return nil, ErrNotGithub{ImportPath: importPath}
     9  	}
    10  	repoUris, basePath, packPath, err := parseImportPath(importPath)
    11  	if err != nil {
    12  		return nil, err
    13  	}
    14  	return &GithubRepo{
    15  		repoUris:   repoUris,
    16  		packPath:   packPath,
    17  		basePath:   basePath,
    18  		importPath: importPath,
    19  	}, nil
    20  }