github.com/sleungcy/cli@v7.1.0+incompatible/util/manifestparser/manifest.go (about) 1 package manifestparser 2 3 type Manifest struct { 4 Applications []Application `yaml:"applications"` 5 Version int `yaml:"version,omitempty"` 6 PathToManifest string `yaml:"-"` 7 } 8 9 func (m Manifest) AppNames() []string { 10 var names []string 11 for _, app := range m.Applications { 12 names = append(names, app.Name) 13 } 14 return names 15 } 16 17 func (m Manifest) ContainsMultipleApps() bool { 18 return len(m.Applications) > 1 19 } 20 21 func (m Manifest) ContainsPrivateDockerImages() bool { 22 for _, app := range m.Applications { 23 if app.Docker != nil && app.Docker.Username != "" { 24 return true 25 } 26 } 27 return false 28 } 29 30 func (m Manifest) GetFirstApp() *Application { 31 return &m.Applications[0] 32 } 33 34 func (m Manifest) GetFirstAppWebProcess() *Process { 35 for i, process := range m.Applications[0].Processes { 36 if process.Type == "web" { 37 return &m.Applications[0].Processes[i] 38 } 39 } 40 41 return nil 42 } 43 44 func (m Manifest) HasAppWithNoName() bool { 45 for _, app := range m.Applications { 46 if app.Name == "" { 47 return true 48 } 49 } 50 return false 51 }