(opts *ViewOptions, project *projects.Project)
| 145 | } |
| 146 | |
| 147 | func formatProjectForBasic(opts *ViewOptions, project *projects.Project) string { |
| 148 | var result strings.Builder |
| 149 | |
| 150 | // header |
| 151 | result.WriteString(fmt.Sprintf("%s %s\n", output.Bold(project.Name), output.Dimf("(%s)", project.Slug))) |
| 152 | |
| 153 | // version control branch |
| 154 | cacBranch := "Not version controlled" |
| 155 | if project.IsVersionControlled { |
| 156 | cacBranch = project.PersistenceSettings.(projects.GitPersistenceSettings).DefaultBranch() |
| 157 | } |
| 158 | result.WriteString(fmt.Sprintf("Version control branch: %s\n", output.Cyan(cacBranch))) |
| 159 | |
| 160 | // tags |
| 161 | if len(project.ProjectTags) > 0 { |
| 162 | result.WriteString(fmt.Sprintf("Tags: %s\n", output.Cyan(output.FormatAsList(project.ProjectTags)))) |
| 163 | } |
| 164 | |
| 165 | // description |
| 166 | if project.Description == "" { |
| 167 | result.WriteString(fmt.Sprintln(output.Dim(constants.NoDescription))) |
| 168 | } else { |
| 169 | result.WriteString(fmt.Sprintln(output.Dim(project.Description))) |
| 170 | } |
| 171 | |
| 172 | // footer with web URL |
| 173 | url := util.GenerateWebURL(opts.Host, project.SpaceID, fmt.Sprintf("projects/%s", project.GetID())) |
| 174 | result.WriteString(fmt.Sprintf("View this project in Octopus Deploy: %s\n", output.Blue(url))) |
| 175 | |
| 176 | if opts.flags.Web.Value { |
| 177 | browser.OpenURL(url) |
| 178 | } |
| 179 | |
| 180 | return result.String() |
| 181 | } |
no test coverage detected