interactive

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: May 18, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package interactive provides auto-prompting for missing required flags using huh forms when running in a TTY.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsInteractive

func IsInteractive(cmd *cobra.Command) bool

IsInteractive returns true when the CLI should use interactive features. Requires both stdin and stdout to be a TTY, --no-interactive must not be set, and agent mode must not be active. Agent mode (auto-detected from AI coding agent env vars or --agent-mode flag) implies non-interactive operation even when running in a real terminal.

func PromptAndSetFlags

func PromptAndSetFlags(cmd *cobra.Command, meta []flagutil.FlagMeta) error

PromptAndSetFlags builds a huh form for unresolved required flags (one per form), then offers to prompt for optional flags too. Each field is shown in its own separate form to avoid multi-group rendering issues.

func PromptForBodyJSON

func PromptForBodyJSON(cmd *cobra.Command, flagName, description string) error

PromptForBodyJSON prompts for a JSON body when the operation uses a single body flag (non-metadata-driven). Used for complex request bodies that aren't expanded into individual flags.

func ShouldPrompt

func ShouldPrompt(cmd *cobra.Command, meta []flagutil.FlagMeta) bool

ShouldPrompt returns true when the command should auto-prompt for missing required flags. This is true when IsInteractive is true and at least one required flag has no value from any resolution source (flag, env, config).

func ShouldPromptForBody

func ShouldPromptForBody(cmd *cobra.Command, flagName string) bool

ShouldPromptForBody returns true when the body flag is unset and we're in interactive mode. Used for non-metadata operations with a single body flag.

Types

This section is empty.

Jump to

Keyboard shortcuts

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