cmdutil

package
v0.0.10 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrShowedUsage = errors.New("showed usage")

ErrShowedUsage is returned when command help was displayed instead of an error.

View Source
var FormatFlag = &cli.StringFlag{
	Name:  "format",
	Usage: "Output format: table, json",
	Value: "table",
}

FormatFlag is the --format flag.

View Source
var LimitFlag = &cli.IntFlag{
	Name:  "limit",
	Usage: "Maximum number of results",
	Value: 30,
}

LimitFlag is the --limit flag.

View Source
var RepoFlag = &cli.StringFlag{
	Name:    "repo",
	Aliases: []string{"r"},
	Usage:   "Repository slug",
}

RepoFlag is the --repo / -r flag.

View Source
var WebFlag = &cli.BoolFlag{
	Name:  "web",
	Usage: "Open in browser",
}

WebFlag is the --web flag.

View Source
var WorkspaceFlag = &cli.StringFlag{
	Name:    "workspace",
	Aliases: []string{"w"},
	Usage:   "Bitbucket workspace slug",
}

WorkspaceFlag is the --workspace / -w flag.

Functions

func CommandNotFound added in v0.0.6

func CommandNotFound(_ context.Context, cmd *cli.Command, command string)

CommandNotFound is a shared handler for unknown subcommands. It prints an error message, suggests a similar command, and lists available commands.

func GetFormat

func GetFormat(ctx context.Context, cmd *cli.Command) string

GetFormat resolves the output format from flags or config.

func HasExplicitInput

func HasExplicitInput(cmd *cli.Command) bool

HasExplicitInput returns true if the user explicitly set any flag or provided any positional args.

func NoArgs

func NoArgs(action cli.ActionFunc) cli.ActionFunc

NoArgs wraps an action to reject unknown positional arguments on leaf commands.

func ResolveWorkspace

func ResolveWorkspace(ctx context.Context, cmd *cli.Command) (string, error)

ResolveWorkspace resolves just the workspace (for commands that don't need a repo).

func ResolveWorkspaceAndRepo

func ResolveWorkspaceAndRepo(ctx context.Context, cmd *cli.Command) (string, string, error)

ResolveWorkspaceAndRepo resolves workspace and repo from flags, git remote, or config.

func WithFactory

func WithFactory(ctx context.Context, f *Factory) context.Context

WithFactory stores the factory in the context.

Types

type Factory

type Factory struct {
	Config    *config.Config
	AuthStore auth.Store
	IOOut     io.Writer
	IOErr     io.Writer
}

Factory holds shared dependencies for commands.

func GetFactory

func GetFactory(ctx context.Context) *Factory

GetFactory retrieves the factory from the context.

func NewFactory

func NewFactory() (*Factory, error)

NewFactory creates a new Factory with default values.

func (*Factory) APIClient

func (f *Factory) APIClient() (*api.Client, error)

APIClient creates an authenticated API client. For OAuth credentials, it auto-refreshes expired tokens before creating the client.

Jump to

Keyboard shortcuts

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