MCPcopy Create free account
hub / github.com/OctopusDeploy/cli / formatProjectForBasic

Function formatProjectForBasic

pkg/cmd/project/view/view.go:147–181  ·  view source on GitHub ↗
(opts *ViewOptions, project *projects.Project)

Source from the content-addressed store, hash-verified

145}
146
147func 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}

Callers 1

viewRunFunction · 0.85

Calls 7

BoldFunction · 0.92
DimfFunction · 0.92
CyanFunction · 0.92
FormatAsListFunction · 0.92
DimFunction · 0.92
GenerateWebURLFunction · 0.92
BlueFunction · 0.92

Tested by

no test coverage detected