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

Function getVariableValueAsTableRow

pkg/cmd/project/variables/view/view.go:189–242  ·  view source on GitHub ↗
(item *VariableValueWithScope)

Source from the content-addressed store, hash-verified

187}
188
189func getVariableValueAsTableRow(item *VariableValueWithScope) []string {
190 v := item.Variable
191 scopeValues := item.ScopeValues
192
193 var value string
194 if v.IsSensitive {
195 value = "*** (sensitive)"
196 } else {
197 value = v.Value
198 }
199
200 description := v.Description
201 if description == "" {
202 description = constants.NoDescription
203 }
204
205 // Build scope summary
206 var scopeParts []string
207 if util.Any(scopeValues.Environments) {
208 scopeParts = append(scopeParts, fmt.Sprintf("Env: %s", formatScopeList(scopeValues.Environments, nil)))
209 }
210 if util.Any(scopeValues.Roles) {
211 scopeParts = append(scopeParts, fmt.Sprintf("Role: %s", formatScopeList(scopeValues.Roles, nil)))
212 }
213 if util.Any(scopeValues.Channels) {
214 scopeParts = append(scopeParts, fmt.Sprintf("Channel: %s", formatScopeList(scopeValues.Channels, nil)))
215 }
216 if util.Any(scopeValues.Machines) {
217 scopeParts = append(scopeParts, fmt.Sprintf("Machine: %s", formatScopeList(scopeValues.Machines, nil)))
218 }
219 if util.Any(scopeValues.TenantTags) {
220 scopeParts = append(scopeParts, fmt.Sprintf("Tag: %s", formatScopeList(scopeValues.TenantTags, func(item *resources.ReferenceDataItem) string {
221 return item.ID
222 })))
223 }
224 if util.Any(scopeValues.Actions) {
225 scopeParts = append(scopeParts, fmt.Sprintf("Step: %s", formatScopeList(scopeValues.Actions, nil)))
226 }
227 if util.Any(scopeValues.Processes) {
228 scopeParts = append(scopeParts, fmt.Sprintf("Process: %s", formatProcessList(scopeValues.Processes)))
229 }
230
231 scopes := strings.Join(scopeParts, "; ")
232 if scopes == "" {
233 scopes = "No scopes"
234 }
235
236 return []string{
237 output.Dim(v.GetID()),
238 value,
239 description,
240 scopes,
241 }
242}
243
244func formatVariableValueForBasic(opts *ViewOptions, item *VariableValueWithScope) string {
245 v := item.Variable

Callers 1

viewRunFunction · 0.85

Calls 4

AnyFunction · 0.92
DimFunction · 0.92
formatScopeListFunction · 0.85
formatProcessListFunction · 0.85

Tested by

no test coverage detected