factory

package
v0.12.0 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2026 License: Apache-2.0 Imports: 8 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 factory provides the dependency injection hub for jira-cli commands. IOStreams is eagerly initialized; Config, Auth, and APIClient are lazy.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Factory

type Factory struct {
	IOStreams *iostreams.IOStreams

	// Global flag values — set by PersistentPreRunE, read by commands.
	Profile      string // --profile
	FlagInstance string // --instance
	FlagUser     string // --user
	FlagToken    string // --token
	OutputJSON   bool   // --json
	NoColor      bool   // --no-color
	Verbose      bool   // --verbose (no-op, stored only)
	DryRun       bool   // --dry-run
	Quiet        bool   // --quiet
	JQExpr       string // --jq
	Text         bool   // --text
	// contains filtered or unexported fields
}

Factory is the dependency injection hub for all CLI commands. IOStreams is always available; Config, AuthResolver, and APIClient are initialized lazily on first access so that auth-free commands (--help, config, alias) never trigger credential resolution.

func New

func New() *Factory

New creates a Factory with real IOStreams. Called once in main.go.

func NewTestFactory

func NewTestFactory(ios *iostreams.IOStreams, cfg config.Config, client *api.Client) *Factory

NewTestFactory creates a pre-wired Factory for tests. All lazy accessors are pre-resolved — no credential resolution occurs. Pass nil for any dependency that the test doesn't need.

func (*Factory) APIClient

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

APIClient returns a configured Jira API client, initializing on first call.

func (*Factory) AuthCredentials

func (f *Factory) AuthCredentials() (*auth.Credentials, error)

AuthCredentials resolves authentication credentials, initializing on first call. Uses the flag > env > profile chain from auth.Resolve().

func (*Factory) Config

func (f *Factory) Config() (config.Config, error)

Config returns the loaded configuration, initializing on first call.

func (*Factory) ResolveInstance

func (f *Factory) ResolveInstance() string

ResolveInstance returns the Jira instance URL using the same resolution chain as auth (flags → env → config profile) but WITHOUT triggering credential or token resolution. Returns empty string if none is configured.

func (*Factory) Stderr

func (f *Factory) Stderr() io.Writer

Stderr returns the stderr writer from IOStreams.

func (*Factory) TokenStore

func (f *Factory) TokenStore() auth.TokenStore

TokenStore returns the credential store, initializing on first call.

Jump to

Keyboard shortcuts

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