github.com/taubyte/tau-cli@v0.1.13-0.20240326000942-487f0d57edfc/singletons/config/project.go (about) 1 package config 2 3 import ( 4 "path" 5 6 projectSchema "github.com/taubyte/go-project-schema/project" 7 "github.com/taubyte/tau-cli/common" 8 singletonsI18n "github.com/taubyte/tau-cli/i18n/singletons" 9 ) 10 11 func (p Project) ConfigLoc() (dir string) { 12 return path.Join(p.Location, common.ConfigRepoDir) 13 } 14 15 func (p Project) CodeLoc() (dir string) { 16 return path.Join(p.Location, common.CodeRepoDir) 17 } 18 19 func (p Project) WebsiteLoc() (dir string) { 20 return path.Join(p.Location, common.WebsiteRepoDir) 21 } 22 23 func (p Project) LibraryLoc() (dir string) { 24 return path.Join(p.Location, common.LibraryRepoDir) 25 } 26 27 func (p Project) Interface() (projectSchema.Project, error) { 28 if len(p.Location) == 0 { 29 return nil, singletonsI18n.ProjectLocationNotFound(p.Name) 30 } 31 32 schema, err := projectSchema.Open(projectSchema.SystemFS(p.ConfigLoc())) 33 if err != nil { 34 return nil, singletonsI18n.OpeningProjectConfigFailed(p.Location, err) 35 } 36 37 return schema, nil 38 }