create

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package create provides the root-level "create" command, which auto-detects its input mode using IOStreams TTY detection: when stdin is a pipe, it delegates to the JSON create path; when stdin is a TTY, it launches the interactive form. This is the convenience entry point — the explicit-mode commands "json create" and "form create" continue to exist independently.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewCmd

func NewCmd(f *cmdutil.Factory) *cli.Command

NewCmd constructs the root-level "create" command, which auto-detects its input mode: when stdin is a pipe, it reads a JSON object and creates the issue (matching "json create" behavior); when stdin is a TTY, it launches the interactive form (matching "form create" behavior).

The --author flag is required for pipe mode (JSON). In TTY mode, the author is collected by the interactive form.

func Run

func Run(ctx context.Context, input RunInput) error

Run routes to the appropriate create implementation based on whether stdin is a TTY. When stdin is a pipe, it delegates to jsoncmd.RunCreate (JSON mode). When stdin is a TTY, it delegates to formcmd.RunFormCreate (interactive form mode).

Types

type RunInput

type RunInput struct {
	Service   driving.Service
	Author    string
	IOStreams *iostreams.IOStreams
	WriteTo   io.Writer

	// FormRunner presents the interactive form and populates data. In
	// production this runs the huh TUI; in tests it is replaced with a
	// function that sets fields directly. Only used in TTY mode.
	FormRunner func(data *formcmd.CreateFormData) error
}

RunInput holds the parameters for the unified create command's core logic, decoupled from CLI flag parsing so it can be tested directly.

Jump to

Keyboard shortcuts

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