prompts

package
v0.1.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 27, 2026 License: Apache-2.0 Imports: 8 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package prompts provides interactive terminal prompts for CLI commands.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RunInitForm

func RunInitForm(extends, name, path, version, schemaOrg, format *string, createSpec *bool) error

RunInitForm runs the interactive form for the init command. It fills the provided pointers with user input.

func RunPortConnectionsForm

func RunPortConnectionsForm(existingConns map[string]opendpi.Connection) ([]opendpi.PortConnection, map[string]opendpi.Connection, error)

RunPortConnectionsForm handles adding connections to a port, allowing both creating new connections and using existing ones.

func RunSchemaForm

func RunSchemaForm(name *string, schema *jsonschema.Schema, schemas map[string]*jsonschema.Schema) error

RunSchemaForm prompts the user to define or select a schema. If name is nil, the schema name prompt is skipped (used for nested schemas like properties/items).

func RunTranslateFormatSelect

func RunTranslateFormatSelect(value *string, formats []string) *huh.Select[string]

RunTranslateFormatSelect returns a select field for choosing translation output format.

Types

type ConnectionAddResult

type ConnectionAddResult struct {
	Name       string
	Connection opendpi.Connection
}

ConnectionAddResult holds the result of connection form functions.

func RunAddNewConnectionForm

func RunAddNewConnectionForm(existingConns map[string]opendpi.Connection) (ConnectionAddResult, error)

RunAddNewConnectionForm runs the interactive form for creating a new connection.

func RunSelectConnectionForm

func RunSelectConnectionForm(existingConns map[string]opendpi.Connection) (ConnectionAddResult, error)

RunSelectConnectionForm prompts for selecting one existing connection.

type PortAddResult

type PortAddResult struct {
	Name        string
	Description string
	Schema      *jsonschema.Schema
	SchemaPath  string
	Connections []opendpi.PortConnection
	NewConns    map[string]opendpi.Connection
}

PortAddResult holds the result of RunAddPortForm.

func RunAddPortForm

func RunAddPortForm(
	existingPorts map[string]opendpi.Port,
	existingConns map[string]opendpi.Connection,
	existingSchemas map[string]*jsonschema.Schema,
) (result PortAddResult, _ error)

RunAddPortForm runs the interactive form for adding a port. Returns PortAddResult containing port name, description, schema, schemaPath (if file selected), connections, and newConns (connections created during this form that need to be added to spec).

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL