commands

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2026 License: Apache-2.0 Imports: 32 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 commands holds the Cobra commands. Each command parses flags, calls the API client through the runtime, and renders; nothing here talks HTTP or the terminal directly.

Index

Constants

This section is empty.

Variables

View Source
var (
	Version = "dev"
	Commit  = "none"
	Date    = "unknown"
)

Build information, set by the linker (GoReleaser).

Functions

func Execute

func Execute(ctx context.Context, d Deps, args []string) int

Execute runs the command tree with args and returns the process exit code. Errors are written to stderr here: text for people, a JSON object with --json.

func New

func New(d Deps) *cobra.Command

New builds the root command.

func ParseRepo

func ParseRepo(s string) (string, bool)

ParseRepo turns "owner/name" or a GitHub remote URL into owner/name.

Types

type Deps

type Deps struct {
	In     io.Reader
	Out    io.Writer
	Err    io.Writer
	Getenv func(string) string
	HTTP   *http.Client
	Store  auth.Store
	// OpenBrowser opens a URL; it returns an error when it can't.
	OpenBrowser func(url string) error
	Sleep       func(context.Context, time.Duration) error
	Now         func() time.Time
	NewKey      func() string
	// StdinTTY and StdoutTTY say whether the streams are terminals.
	StdinTTY, StdoutTTY bool
	// GitOrigin returns the `origin` remote URL of the current checkout, or "".
	GitOrigin func() string
	Hostname  func() string
	// PollInterval is how often --wait checks the session.
	PollInterval time.Duration
	// MakeRaw puts the terminal's input in raw mode for the interactive chat and returns the
	// function that restores it. Nil: the chat reads plain lines.
	MakeRaw func() (restore func(), err error)
	// TermWidth is the terminal's width in columns; nil or 0 means 80.
	TermWidth func() int
	// RetryDelay overrides the API client's base retry delay when non-zero.
	RetryDelay time.Duration
}

Deps is everything the commands need from the outside world, so tests can replace it.

func DefaultDeps

func DefaultDeps(store auth.Store) Deps

DefaultDeps wires the real process.

Jump to

Keyboard shortcuts

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