cmdutil

package
v0.10.2 Latest Latest
Warning

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

Go to latest
Published: Feb 6, 2026 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddJSONFlags

func AddJSONFlags(cmd *cobra.Command, flags *JSONFlags)

AddJSONFlags adds --json, --jq, and --template flags to a command.

func FetchSpaceStatuses added in v0.9.0

func FetchSpaceStatuses(client *api.Client, spaceID string) ([]string, error)

FetchSpaceStatuses fetches the available status names for a ClickUp space.

func FetchSpaceTags added in v0.10.0

func FetchSpaceTags(client *api.Client, spaceID string) ([]string, error)

FetchSpaceTags fetches the available tag names for a ClickUp space.

func FormatRecentTaskOption added in v0.5.0

func FormatRecentTaskOption(t RecentTask) string

FormatRecentTaskOption formats a RecentTask for display in a selection prompt.

func IsAuthError

func IsAuthError(err error) bool

IsAuthError checks if the error is an AuthError.

func IsSilentError

func IsSilentError(err error) bool

IsSilentError checks if the error is a SilentError.

func LocationSummary added in v0.5.0

func LocationSummary(tasks []RecentTask) []string

LocationSummary returns a deduplicated summary of locations from recent tasks, e.g. "Folder > List" pairs. Useful for suggesting where to search.

func MatchStatus added in v0.9.0

func MatchStatus(target string, available []string) (string, error)

MatchStatus finds the best matching status from available statuses using a tiered strategy: 1. Exact match (case-insensitive) 2. Contains match (case-insensitive) 3. Fuzzy match using normalized fold ranking

func NeedsAuth

func NeedsAuth(f *Factory) func(cmd *cobra.Command, args []string) error

NeedsAuth returns a pre-run function that validates authentication before command execution.

func ValidateStatus added in v0.9.0

func ValidateStatus(client *api.Client, spaceID, status string, w io.Writer) (string, error)

ValidateStatus validates a status string against the available statuses for a space. If the status fuzzy-matches, it returns the matched value and prints a warning to w. If no match, it returns an error with available statuses. If validation cannot be performed (e.g. network error), the original status is returned unchanged.

func ValidateTags added in v0.10.0

func ValidateTags(client *api.Client, spaceID string, tags []string, w io.Writer) []string

ValidateTags validates tag names against the available tags for a space. Unknown tags are warned about and filtered out. Only valid tags are returned. If validation cannot be performed (e.g. network error), all tags are returned unchanged.

Types

type AuthError

type AuthError struct {
	Message string
}

AuthError indicates an authentication failure.

func (*AuthError) Error

func (e *AuthError) Error() string

type Factory

type Factory struct {
	IOStreams *iostreams.IOStreams
	// contains filtered or unexported fields
}

Factory provides lazy-initialized dependencies to commands.

func NewFactory

func NewFactory(ios *iostreams.IOStreams) *Factory

NewFactory creates a new Factory with the given IOStreams.

func (*Factory) ApiClient

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

ApiClient returns an authenticated API client (cached after first call).

func (*Factory) Config

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

Config returns the loaded configuration (cached after first call).

func (*Factory) GitClient

func (f *Factory) GitClient() *gitpkg.Client

GitClient returns a new git client.

func (*Factory) GitContext

func (f *Factory) GitContext() (*gitpkg.RepoContext, error)

GitContext returns the detected git context (cached after first call).

type JSONFlags

type JSONFlags struct {
	JSON     bool
	JQ       string
	Template string
}

JSONFlags holds the --json, --jq, and --template flags.

func (*JSONFlags) OutputJSON

func (f *JSONFlags) OutputJSON(w io.Writer, data interface{}) error

OutputJSON writes data as JSON, optionally filtered by jq or formatted by a template.

func (*JSONFlags) WantsJSON

func (f *JSONFlags) WantsJSON() bool

WantsJSON returns true if JSON output is requested (via --json, --jq, or --template).

type RecentTask added in v0.5.0

type RecentTask struct {
	ID         string `json:"id"`
	CustomID   string `json:"custom_id,omitempty"`
	Name       string `json:"name"`
	Status     string `json:"status"`
	ListName   string `json:"list_name"`
	FolderName string `json:"folder_name"`
}

RecentTask represents a recently updated task with location context.

func FetchRecentTasks added in v0.5.0

func FetchRecentTasks(f *Factory, limit int) ([]RecentTask, error)

FetchRecentTasks fetches the current user's recently updated tasks. Uses 2 API calls: one for user identity, one for filtered tasks. Returns up to `limit` tasks ordered by most recently updated.

func FetchRecentTeamTasks added in v0.5.0

func FetchRecentTeamTasks(f *Factory, limit int) ([]RecentTask, error)

FetchRecentTeamTasks fetches recently updated tasks for the whole team (no assignee filter). Uses 1 API call.

type SilentError

type SilentError struct {
	Err error
}

SilentError is an error that should not be printed (the command already handled output).

func (*SilentError) Error

func (e *SilentError) Error() string

func (*SilentError) Unwrap

func (e *SilentError) Unwrap() error

Jump to

Keyboard shortcuts

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