Documentation
¶
Index ¶
- func AddForceFlag(cmd *cobra.Command, force *bool)
- func AddOutputFlag(cmd *cobra.Command, format *string)
- func AddPaginationFlags(cmd *cobra.Command, limit, offset *int)
- func CompleteActivities(f *Factory) ...
- func CompleteCategories(f *Factory) ...
- func CompleteGroups(f *Factory) ...
- func CompleteIssueListStatus(f *Factory) ...
- func CompleteOpenVersions(f *Factory) ...
- func CompleteOutputFormat(_ *cobra.Command, _ []string, toComplete string) ([]string, cobra.ShellCompDirective)
- func CompletePriorities(f *Factory) ...
- func CompleteProjects(f *Factory) ...
- func CompleteStatuses(f *Factory) ...
- func CompleteTrackers(f *Factory) ...
- func CompleteUserStatus(_ *cobra.Command, _ []string, toComplete string) ([]string, cobra.ShellCompDirective)
- func CompleteUsers(f *Factory) ...
- func CompleteVersionStatus(_ *cobra.Command, _ []string, toComplete string) ([]string, cobra.ShellCompDirective)
- func CompleteVersions(f *Factory) ...
- func ConfirmAction(in io.Reader, errOut io.Writer, message string) bool
- func DefaultProject(f *Factory, project string) string
- func DefaultProjectID(ctx context.Context, f *Factory, project string) (string, error)
- func DefaultProjectIdentifier(ctx context.Context, f *Factory, project string) (string, error)
- func FormatError(err error) string
- func HandleEmpty[T any](p output.Printer, items []T, noun string) bool
- func RequireProjectIdentifier(ctx context.Context, f *Factory, project string) (string, error)
- func ResolveProjectID(ctx context.Context, f *Factory, input string) (string, error)
- func ResolveProjectIdentifier(ctx context.Context, f *Factory, input string) (string, error)
- func WarnPagination(p output.Printer, r PaginationResult)
- type Factory
- type IOStreams
- type PaginationResult
- type SilentError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddForceFlag ¶
AddForceFlag adds the --force/-f flag to a command.
func AddOutputFlag ¶
AddOutputFlag adds the --output/-o flag to a command.
func AddPaginationFlags ¶
AddPaginationFlags adds --limit and --offset flags to a command.
func CompleteActivities ¶ added in v1.11.0
func CompleteActivities(f *Factory) func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective)
CompleteActivities returns a completion function for the --activity flag.
func CompleteCategories ¶ added in v1.11.0
func CompleteCategories(f *Factory) func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective)
CompleteCategories returns a completion function for the --category flag. Requires --project to be set (or a default project in config).
func CompleteGroups ¶ added in v1.11.0
func CompleteGroups(f *Factory) func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective)
CompleteGroups returns a completion function for the --group flag. Returns empty completions gracefully if the user lacks admin privileges.
func CompleteIssueListStatus ¶ added in v1.11.0
func CompleteIssueListStatus(f *Factory) func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective)
CompleteIssueListStatus returns a completion function for the --status flag on the issues list command, which also accepts special values.
func CompleteOpenVersions ¶ added in v1.11.0
func CompleteOpenVersions(f *Factory) func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective)
CompleteOpenVersions returns a completion function for the --version flag that only shows open and locked versions (excludes closed). Useful for create/update commands where closed versions aren't valid targets.
func CompleteOutputFormat ¶ added in v1.11.0
func CompleteOutputFormat(_ *cobra.Command, _ []string, toComplete string) ([]string, cobra.ShellCompDirective)
CompleteOutputFormat provides static completions for the --output flag.
func CompletePriorities ¶ added in v1.11.0
func CompletePriorities(f *Factory) func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective)
CompletePriorities returns a completion function for the --priority flag.
func CompleteProjects ¶ added in v1.11.0
func CompleteProjects(f *Factory) func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective)
CompleteProjects returns a completion function for the --project flag.
func CompleteStatuses ¶ added in v1.11.0
func CompleteStatuses(f *Factory) func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective)
CompleteStatuses returns a completion function for the --status flag.
func CompleteTrackers ¶ added in v1.11.0
func CompleteTrackers(f *Factory) func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective)
CompleteTrackers returns a completion function for the --tracker flag.
func CompleteUserStatus ¶ added in v1.11.0
func CompleteUserStatus(_ *cobra.Command, _ []string, toComplete string) ([]string, cobra.ShellCompDirective)
CompleteUserStatus provides static completions for user --status flag.
func CompleteUsers ¶ added in v1.11.0
func CompleteUsers(f *Factory) func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective)
CompleteUsers returns a completion function for user-related flags. Returns empty completions gracefully if the user lacks admin privileges.
func CompleteVersionStatus ¶ added in v1.11.0
func CompleteVersionStatus(_ *cobra.Command, _ []string, toComplete string) ([]string, cobra.ShellCompDirective)
CompleteVersionStatus provides static completions for version --status flag.
func CompleteVersions ¶ added in v1.11.0
func CompleteVersions(f *Factory) func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective)
CompleteVersions returns a completion function for the --version flag that shows all versions including closed ones. Requires --project to be set (or a default project in config).
func ConfirmAction ¶
ConfirmAction prompts the user to confirm a destructive action. Returns true if the user confirms with "y" or "yes". If in is not interactive or the user declines, returns false.
func DefaultProject ¶ added in v1.11.1
DefaultProject returns the given project string if non-empty, otherwise falls back to the configured default project. If the config cannot be loaded the original (empty) value is returned.
func DefaultProjectID ¶ added in v1.11.1
DefaultProjectID applies the default-project fallback and resolves to a numeric ID string. Returns ("", nil) when no project is specified.
func DefaultProjectIdentifier ¶ added in v1.11.1
DefaultProjectIdentifier applies the default-project fallback and resolves to the canonical identifier. Returns ("", nil) when no project is specified.
func FormatError ¶
FormatError converts an API error into a user-friendly message.
func HandleEmpty ¶ added in v1.11.1
HandleEmpty checks whether items is empty. For empty slices it emits an empty JSON array (when the output format is JSON) or a warning (for other formats) and returns true. The caller should return nil when true.
func RequireProjectIdentifier ¶ added in v1.11.1
RequireProjectIdentifier applies the default-project fallback, ensures a project was provided, and resolves to the canonical identifier.
func ResolveProjectID ¶ added in v1.10.1
ResolveProjectID resolves a project input to its numeric ID string.
func ResolveProjectIdentifier ¶ added in v1.10.1
ResolveProjectIdentifier resolves a project input to its canonical identifier.
func WarnPagination ¶ added in v1.11.1
func WarnPagination(p output.Printer, r PaginationResult)
WarnPagination emits a pagination warning when there are more results than shown. No warning is emitted when limit is 0 (all results requested) or when the output format is JSON.
Types ¶
type Factory ¶
type Factory struct {
ConfigPath string
Verbose bool
// Runtime overrides from CLI flags (highest precedence).
ServerOverride string
APIKeyOverride string
NoColorOverride bool
IOStreams *IOStreams
// contains filtered or unexported fields
}
Factory provides lazy access to configuration, API client, and output printer.
func NewFactory ¶
func NewFactory() *Factory
NewFactory creates a new Factory with default I/O streams.
func (*Factory) Config ¶
Config returns the loaded configuration (cached after first call). CLI flag overrides (ServerOverride, APIKeyOverride, NoColorOverride) are applied after loading from file and environment, giving them the highest precedence.
func (*Factory) DebugLogger ¶
DebugLogger returns the debug logger, creating it on first call.
type PaginationResult ¶ added in v1.11.1
type PaginationResult struct {
Shown int // Number of items displayed
Total int // Total count from the API
Limit int // The --limit value used
Offset int // The --offset value used
Noun string // Plural noun for the message, e.g. "issues"
}
PaginationResult holds the information needed to emit a pagination warning.
type SilentError ¶ added in v1.10.0
type SilentError struct{ Code int }
SilentError is returned when the error message has already been printed or should be suppressed. main.go will still exit with the given code.
func (*SilentError) Error ¶ added in v1.10.0
func (e *SilentError) Error() string