(record configValidateRecord)
| 1428 | } |
| 1429 | |
| 1430 | func configValidateBundle(record configValidateRecord) outputBundle { |
| 1431 | rows := []keyValue{ |
| 1432 | {Label: configStatusValue, Value: stringOrDash(record.Status)}, |
| 1433 | {Label: configScopeValue, Value: stringOrDash(record.Scope)}, |
| 1434 | {Label: configWorkspaceValue, Value: stringOrDash(record.WorkspaceRoot)}, |
| 1435 | {Label: "Config File", Value: stringOrDash(record.ConfigFile)}, |
| 1436 | {Label: configRedactedValue, Value: strconv.FormatBool(record.Redacted)}, |
| 1437 | } |
| 1438 | if record.DotEnv != nil { |
| 1439 | rows = append(rows, |
| 1440 | keyValue{Label: ".env Path", Value: stringOrDash(record.DotEnv.Path)}, |
| 1441 | keyValue{Label: ".env Status", Value: stringOrDash(record.DotEnv.Status)}, |
| 1442 | keyValue{Label: ".env Repaired", Value: strconv.FormatBool(record.DotEnv.Repaired)}, |
| 1443 | ) |
| 1444 | if len(record.DotEnv.Diagnostics) > 0 { |
| 1445 | rows = append(rows, keyValue{ |
| 1446 | Label: ".env Diagnostics", |
| 1447 | Value: strings.Join(dotEnvDiagnosticSummaries(record.DotEnv.Diagnostics), "; "), |
| 1448 | }) |
| 1449 | } |
| 1450 | } |
| 1451 | return outputBundle{ |
| 1452 | jsonValue: record, |
| 1453 | human: func() (string, error) { |
| 1454 | return renderHumanSection("Config Validation", rows), nil |
| 1455 | }, |
| 1456 | toon: func() (string, error) { |
| 1457 | fields := []string{ |
| 1458 | configStatusKey, |
| 1459 | configScopeKey, |
| 1460 | configWorkspaceRootKey, |
| 1461 | "config_file", |
| 1462 | configRedactedKey, |
| 1463 | } |
| 1464 | values := []string{ |
| 1465 | record.Status, |
| 1466 | record.Scope, |
| 1467 | record.WorkspaceRoot, |
| 1468 | record.ConfigFile, |
| 1469 | strconv.FormatBool(record.Redacted), |
| 1470 | } |
| 1471 | if record.DotEnv != nil { |
| 1472 | fields = append(fields, "dot_env_status", "dot_env_repaired") |
| 1473 | values = append(values, record.DotEnv.Status, strconv.FormatBool(record.DotEnv.Repaired)) |
| 1474 | } |
| 1475 | return renderToonObject("config_validation", fields, values), nil |
| 1476 | }, |
| 1477 | } |
| 1478 | } |
| 1479 | |
| 1480 | func dotEnvDiagnosticSummaries(diagnostics []aghconfig.DotEnvDiagnostic) []string { |
| 1481 | summaries := make([]string, 0, len(diagnostics)) |
no test coverage detected