{"modulePath":"github.com/newstack-cloud/deploy-cli-sdk","version":"v0.10.0","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package headless\n\n## Constants\n\n```go\nconst RedactedValue = \"\u003credacted\u003e\"\n```\nRedactedValue stands in for a value the provider declared sensitive.\n\n## Functions\n\n```go\nfunc DiagnosticLevelName(level DiagnosticLevel) string\n```\nDiagnosticLevelName returns the display name for a diagnostic level.\n\n```go\nfunc FormatFieldValue(sensitive bool, node *core.MappingNode) string\n```\nFormatFieldValue formats one side of a field change, standing a placeholder in for a value the provider declared sensitive.\n\nEvery field value the CLI prints goes through here rather than FormatMappingNode directly, because a change set is rendered to a terminal, to a log a CI system keeps, and to JSON someone redirects to a file. A secret only has to be printed once.\n\n```go\nfunc FormatMappingNode(node *core.MappingNode) string\n```\nFormatMappingNode formats a MappingNode for display.\n\nPrefer FormatFieldValue when the node is a field change value, so a sensitive field is not printed.\n\n```go\nfunc FormatMappingNodeWithOptions(node *core.MappingNode, opts FormatMappingNodeOptions) string\n```\nFormatMappingNodeWithOptions formats a MappingNode for display with configurable options.\n\n```go\nfunc FormatScalarValue(scalar *core.ScalarValue) string\n```\nFormatScalarValue formats a ScalarValue for display.\n\n```go\nfunc IsHeadless() bool\n```\nIsHeadless returns true if not running in an interactive terminal\n\n```go\nfunc SetHeadlessForTesting(headless bool) func()\n```\nSetHeadlessForTesting overrides IsHeadless for testing purposes. Returns a cleanup function that restores the original behavior.\n\n```go\nfunc Validate(requirements ...Requirement) error\n```\nValidate checks all requirements, but only if in headless mode. In interactive mode, returns nil (TUI will handle missing values).\n\n## Types\n\n```go\ntype Condition interface {\n\tIsMet() bool\n\tDescription() string\n}\n```\nCondition represents a predicate that can be evaluated\n\n```go\nfunc BoolFlagTrue(name string, value bool) Condition\n```\nBoolFlagTrue returns a condition that is true when the bool flag is set to true\n\n```go\nfunc FlagEquals(f Flag, value string) Condition\n```\nFlagEquals returns a condition that is true when the flag has the specified value\n\n```go\nfunc FlagPresent(f Flag) Condition\n```\nFlagPresent returns a condition that is true when the flag is explicitly set\n\n```go\ntype DiagnosticLevel int\n```\nDiagnosticLevel represents the level of a diagnostic.\n\n```go\nconst (\n\tDiagnosticLevelError DiagnosticLevel = iota\n\tDiagnosticLevelWarning\n\tDiagnosticLevelInfo\n)\n```\n\n```go\nfunc DiagnosticLevelFromCore(level core.DiagnosticLevel) DiagnosticLevel\n```\nDiagnosticLevelFromCore converts core.DiagnosticLevel to headless.DiagnosticLevel.\n\n```go\ntype Flag struct {\n\tName      string // Flag name for error messages (e.g., \"blueprint-file\")\n\tValue     string // Current value\n\tIsDefault bool   // True if using default value (not explicitly set)\n}\n```\nFlag represents a flag value with its default status\n\n```go\ntype FormatMappingNodeOptions struct {\n\t// PrettyPrint enables JSON pretty-printing for arrays and maps\n\t// instead of the concise representation ({...}, [...]).\n\tPrettyPrint bool\n\t// Indent specifies the indentation string for pretty-printing.\n\t// Defaults to \"  \" (two spaces) if empty.\n\tIndent string\n}\n```\nFormatMappingNodeOptions configures how MappingNode values are formatted.\n\n```go\ntype PrefixedWriter struct {\n\t// contains filtered or unexported fields\n}\n```\nPrefixedWriter wraps an io.Writer to auto-prefix all lines.\n\n```go\nfunc NewPrefixedWriter(w io.Writer, prefix string) *PrefixedWriter\n```\nNewPrefixedWriter creates a writer that prefixes all output lines.\n\n```go\nfunc (pw *PrefixedWriter) DoubleSeparator(width int)\n```\nDoubleSeparator writes a double-line separator (═).\n\n```go\nfunc (pw *PrefixedWriter) Prefix() string\n```\nPrefix returns the prefix string.\n\n```go\nfunc (pw *PrefixedWriter) Printf(format string, args ...any)\n```\nPrintf writes a formatted line with the prefix.\n\n```go\nfunc (pw *PrefixedWriter) Println(s string)\n```\nPrintln writes a line with the prefix.\n\n```go\nfunc (pw *PrefixedWriter) PrintlnEmpty()\n```\nPrintlnEmpty writes an empty line (no prefix).\n\n```go\nfunc (pw *PrefixedWriter) Separator(char rune, width int)\n```\nSeparator writes a separator line with the given character.\n\n```go\nfunc (pw *PrefixedWriter) SingleSeparator(width int)\n```\nSingleSeparator writes a single-line separator (─).\n\n```go\nfunc (pw *PrefixedWriter) Writer() io.Writer\n```\nWriter returns the underlying io.Writer.\n\n```go\ntype Printer struct {\n\t// contains filtered or unexported fields\n}\n```\nPrinter provides common headless output patterns.\n\n```go\nfunc NewPrinter(w *PrefixedWriter, width int) *Printer\n```\nNewPrinter creates a headless printer.\n\n```go\nfunc (p *Printer) CountSummary(count int, singular, plural, verb string)\n```\nCountSummary prints a count with pluralization.\n\n```go\nfunc (p *Printer) Diagnostic(level string, message string, line, col int)\n```\nDiagnostic prints a diagnostic message with level, location, and wrapped text.\n\n```go\nfunc (p *Printer) FieldAdd(path, value string)\n```\nFieldAdd prints an added field.\n\n```go\nfunc (p *Printer) FieldContributedByLink(linkName string)\n```\nFieldContributedByLink prints which link a field belongs to, under the change to it.\n\n```go\nfunc (p *Printer) FieldKnownOnDeploy(path string)\n```\nFieldKnownOnDeploy prints a field whose value is not settled until the deployment runs.\n\n```go\nfunc (p *Printer) FieldModify(path, oldValue, newValue string)\n```\nFieldModify prints a modified field.\n\n```go\nfunc (p *Printer) FieldRemove(path string)\n```\nFieldRemove prints a removed field.\n\n```go\nfunc (p *Printer) ItemHeader(itemType, name, action string)\n```\nItemHeader prints an item header with type, name, and action. Format: itemType (padded to 10 chars) + space + name + padding + action The action is right-aligned to column 60.\n\n```go\nfunc (p *Printer) LinkContributionNotApplied(linkName, fieldPath, reason string)\n```\nLinkContributionNotApplied prints a contribution a link records against a resource that could not be composed into its spec.\n\n```go\nfunc (p *Printer) NextStep(description, command string)\n```\nNextStep prints a \"to do X, run:\" instruction.\n\n```go\nfunc (p *Printer) NoChanges()\n```\nNoChanges prints a \"no changes\" message.\n\n```go\nfunc (p *Printer) ProgressItem(icon, itemType, name, action, suffix string)\n```\nProgressItem prints a progress event line. Format: icon type: name - action (suffix)\n\n```go\nfunc (p *Printer) Width() int\n```\nWidth returns the configured terminal width.\n\n```go\nfunc (p *Printer) Writer() *PrefixedWriter\n```\nWriter returns the underlying PrefixedWriter.\n\n```go\ntype Requirement interface {\n\tValidate() error\n}\n```\nRequirement defines a validation rule\n\n```go\nfunc OneOf(flags ...Flag) Requirement\n```\nOneOf creates a rule that at least one of the flags must be provided\n\n```go\nfunc Required(f Flag) Requirement\n```\nRequired creates a rule that the flag must be explicitly provided\n\n```go\nfunc RequiredIf(condition Condition, target Flag) Requirement\n```\nRequiredIf creates a rule that the target flag is required when the condition is met\n\n```go\nfunc RequiredIfBool(condition Condition, targetName string, targetValue bool) Requirement\n```\nRequiredIfBool creates a rule that the target bool flag must be true when the condition is met\n\n","path":"github.com/newstack-cloud/deploy-cli-sdk/headless","name":"headless","synopsis":"","isRedistributable":true}
