cmd

package
v0.1.0-alpha.89 Latest Latest
Warning

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

Go to latest
Published: May 30, 2026 License: Apache-2.0 Imports: 68 Imported by: 0

Documentation

Index

Constants

View Source
const Version = "0.1.0-alpha.89" // 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 CheckForUpdate

func CheckForUpdate() <-chan string

CheckForUpdate starts a background check for new versions and returns a channel that will contain an update message if one is available

func ConfigDir

func ConfigDir() (string, error)

ConfigDir returns the directory where config files are stored

func Rel

func Rel(basepath, targpath string) string

Rel returns a relative path similar to filepath.Rel but with custom behavior: - If target is empty, returns empty string - If relative path doesn't start with "../", it prefixes with "./"

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

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 AuthConfig

type AuthConfig struct {
	AccessToken  string `json:"access_token"`
	RefreshToken string `json:"refresh_token,omitempty"`
	TokenType    string `json:"token_type"`

	ConfigPath string `json:"-"`
}

AuthConfig stores the OAuth credentials

func NewAuthConfig

func NewAuthConfig() (*AuthConfig, error)

NewAuthConfig creates a new AuthConfig with ConfigPath populated. Use this when creating a new config that you plan to save. For loading existing configs, use &AuthConfig{} and call Find() or Load().

func (*AuthConfig) Exists

func (config *AuthConfig) Exists() bool

Exists checks if the auth config file exists

func (*AuthConfig) Find

func (config *AuthConfig) Find() (bool, error)

Find searches for and loads the auth config from the standard location. Returns (true, nil) if config file exists and was successfully loaded. Returns (false, nil) if config file doesn't exist or is empty (not an error). Returns (false, error) if config file exists but failed to load due to an error.

func (*AuthConfig) Load

func (config *AuthConfig) Load(configPath string) error

Load loads the auth config from a specific path. Returns nil if the file doesn't exist (not treated as an error). Returns nil if the file exists but is empty (not treated as an error). Returns error only if the file exists but fails to parse or read. Only sets ConfigPath if a valid config with AccessToken is successfully loaded.

func (*AuthConfig) Remove

func (config *AuthConfig) Remove() error

Remove removes the auth config file

func (*AuthConfig) Save

func (config *AuthConfig) Save() error

Save saves the auth config to disk

type BodyContentType

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

type FileEmbedStyle

type FileEmbedStyle int
const (
	// EmbedText reads referenced files fully into memory and substitutes the file's contents back into the
	// value as a string. Binary files are base64-encoded. Used for JSON request bodies and for headers and
	// query parameters, where the file contents need to be serialized inline.
	EmbedText FileEmbedStyle = iota

	// EmbedIOReader replaces file references with an io.Reader that streams the file's contents. Used for
	// `multipart/form-data` and `application/octet-stream` request bodies, where files are uploaded as binary
	// parts rather than embedded into a text value.
	EmbedIOReader
)

type FilePathValue

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 GenerateSpecParams

type GenerateSpecParams struct {
	Project string `json:"project"`
	Source  struct {
		Type            string `json:"type"`
		OpenAPISpec     string `json:"openapi_spec"`
		StainlessConfig string `json:"stainless_config"`
	} `json:"source"`
}

type GitHubRelease

type GitHubRelease struct {
	TagName string `json:"tag_name"`
}

type ShowJSONOpts

type ShowJSONOpts struct {
	ExplicitFormat bool      // true if the user explicitly passed --format
	Format         string    // output format (auto, explore, json, jsonl, pretty, raw, yaml)
	RawOutput      bool      // like jq -r: print strings without JSON quotes
	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.

type TargetInfo

type TargetInfo struct {
	DisplayName     string
	Name            stainless.Target
	DefaultSelected bool
}

TargetInfo represents a target with its display name and default selection

Jump to

Keyboard shortcuts

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