{"modulePath":"github.com/newstack-cloud/deploy-cli-sdk","version":"v0.10.1","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package outpututil\n\nPackage outpututil provides shared utilities for rendering resource outputs (computed fields from spec data) across different UI components.\n\n## Functions\n\n```go\nfunc ConvertSpecPathToLookupPath(fieldPath string) string\n```\nConvertSpecPathToLookupPath converts a spec field path (e.g., \"spec.id\") to a lookup path for core.GetPathValue (e.g., \"$.id\").\n\n```go\nfunc CountNonComputedFields(specData *core.MappingNode, computedFields []string) int\n```\nCountNonComputedFields counts the number of non-computed fields in spec data.\n\n```go\nfunc FormatDuration(milliseconds float64) string\n```\nFormatDuration formats a duration in milliseconds to a human-friendly string. - \\\u003c 1000ms: \"XXXms\" - \\\u003c 60s: \"X.XXs\" - \u003e= 60s: \"Xm Ys\"\n\n```go\nfunc IsInternalFieldPath(fieldPath string) bool\n```\nIsInternalFieldPath reports whether a spec field path refers to a provider internal property, at any depth. The path is expected to have had its \"spec.\" prefix stripped already.\n\n```go\nfunc IsPlausibleDuration(milliseconds float64) bool\n```\nIsPlausibleDuration reports whether a reported duration in milliseconds can be a real measurement. Negative values and sentinels are rejected.\n\n```go\nfunc IsValidOutputValue(value string) bool\n```\nIsValidOutputValue checks if a formatted value should be displayed.\n\n```go\nfunc RenderOutputFields(fields []OutputField, width int, s *styles.Styles) string\n```\nRenderOutputFields renders a sorted list of output fields with wrapping support. Uses \"Current Outputs:\" as the default label.\n\n```go\nfunc RenderOutputFieldsWithLabel(fields []OutputField, label string, width int, s *styles.Styles) string\n```\nRenderOutputFieldsWithLabel renders a sorted list of output fields with a custom label.\n\n```go\nfunc RenderOutputsFromState(\n\tresourceState *state.ResourceState,\n\twidth int,\n\ts *styles.Styles,\n) string\n```\nRenderOutputsFromState renders outputs from ResourceState. Uses ResourceState.ComputedFields to determine which fields to display.\n\n```go\nfunc RenderSpecFields(specData *core.MappingNode, computedFields []string, width int, s *styles.Styles) string\n```\nRenderSpecFields renders non-computed spec fields with a label.\n\n```go\nfunc RenderSpecHint(specData *core.MappingNode, computedFields []string, s *styles.Styles) string\n```\nRenderSpecHint renders a hint line showing the spec field count and keyboard shortcut.\n\n```go\nfunc WrapText(text string, width int) string\n```\nWrapText wraps text to fit within the specified width.\n\n```go\nfunc WrapTextLines(text string, width int) []string\n```\nWrapTextLines wraps text to fit within the specified width, returning lines as a slice. Uses word-boundary wrapping: breaks at spaces when possible, otherwise at width.\n\n## Types\n\n```go\ntype ExportField struct {\n\tName        string\n\tValue       string\n\tType        string\n\tDescription string\n\tField       string\n}\n```\nExportField holds export data for rendering, including metadata about the export.\n\n```go\nfunc CollectExportFields(exports map[string]*state.ExportState) []ExportField\n```\nCollectExportFields extracts exports from instance state, sorted alphabetically by name.\n\n```go\nfunc CollectExportFieldsPretty(exports map[string]*state.ExportState) []ExportField\n```\nCollectExportFieldsPretty extracts exports with pretty-printed JSON values.\n\n```go\ntype OutputField struct {\n\tName  string\n\tValue string\n}\n```\nOutputField holds a name-value pair for output rendering.\n\n```go\nfunc CollectNonComputedFields(specData *core.MappingNode, computedFields []string) []OutputField\n```\nCollectNonComputedFields extracts all fields from spec data excluding computed fields. This is used to show the user-provided spec without the computed outputs. Fields are returned sorted alphabetically by name for consistent display.\n\n```go\nfunc CollectNonComputedFieldsPretty(specData *core.MappingNode, computedFields []string) []OutputField\n```\nCollectNonComputedFieldsPretty extracts all fields from spec data excluding computed fields, using pretty-printed JSON for complex nested structures. Fields are returned sorted alphabetically by name for consistent display.\n\n```go\nfunc CollectOutputFields(specData *core.MappingNode, computedFields []string) []OutputField\n```\nCollectOutputFields extracts field entries from spec data, with nested values rendered concisely so that each field occupies a single line. Uses computedFields paths if provided, otherwise extracts all top-level fields.\n\n```go\nfunc CollectOutputFieldsPretty(specData *core.MappingNode, computedFields []string) []OutputField\n```\nCollectOutputFieldsPretty is CollectOutputFields with nested values rendered as indented JSON. Use it in the full-screen views, where a value spanning several lines costs nothing and collapsing it to \"{...}\" hides the output the view exists to show.\n\n","path":"github.com/newstack-cloud/deploy-cli-sdk/tui/outpututil","name":"outpututil","synopsis":"Package outpututil provides shared utilities for rendering resource outputs (computed fields from spec data) across different UI components.","isRedistributable":true}
