(item *VariableValueWithScope)
| 187 | } |
| 188 | |
| 189 | func 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 | |
| 244 | func formatVariableValueForBasic(opts *ViewOptions, item *VariableValueWithScope) string { |
| 245 | v := item.Variable |
no test coverage detected