cmd

package
v0.27.0 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2026 License: Apache-2.0 Imports: 40 Imported by: 0

Documentation

Index

Constants

View Source
const Version = "0.27.0" // x-release-please-version

Variables

View Source
var (
	Command            *cli.Command
	CommandErrorBuffer bytes.Buffer
)
View Source
var OutputFormats = []string{"auto", "explore", "json", "jsonl", "pretty", "raw", "yaml"}

Functions

func ShowJSON

func ShowJSON(res gjson.Result, opts ShowJSONOpts) error

ShowJSON displays a single JSON result to the user.

func ShowJSONIterator

func ShowJSONIterator[T any](iter jsonview.Iterator[T], itemsToDisplay int64, opts ShowJSONOpts) error

ShowJSONIterator displays an iterator of values to the user. Use itemsToDisplay = -1 for no limit.

func ValidateBaseURL added in v0.26.0

func ValidateBaseURL(value, source string) error

ValidateBaseURL checks that a base URL is correctly prefixed with a protocol scheme and produces a better error message than the person would see otherwise if it doesn't.

Types

type BodyContentType

type BodyContentType int
const (
	EmptyBody BodyContentType = iota
	MultipartFormEncoded
	ApplicationJSON
	ApplicationOctetStream
)

type FileEmbedStyle

type FileEmbedStyle int
const (
	EmbedText FileEmbedStyle = iota
	EmbedIOReader
)

type FilePathValue added in v0.26.0

type FilePathValue string

FilePathValue is a string wrapper that marks a value as a file path whose contents should be read and embedded in the request. Unlike a regular string, embedFilesValue always treats a FilePathValue as a file path without needing the "@" prefix.

type ShowJSONOpts added in v0.27.0

type ShowJSONOpts struct {
	ExplicitFormat bool      // true if the user explicitly passed --format
	Format         string    // output format (auto, explore, json, jsonl, pretty, raw, yaml)
	Stderr         io.Writer // stderr for warnings; injectable for testing; defaults to os.Stderr
	Stdout         *os.File  // stdout (or pager); injectable for testing; defaults to os.Stdout
	Title          string    // display title
	Transform      string    // GJSON path to extract before displaying
}

ShowJSONOpts configures how JSON output is displayed.

Jump to

Keyboard shortcuts

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