cmdutil

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultLanguage = "en-US"

DefaultLanguage is the language a project falls back to when none is chosen.

Variables

This section is empty.

Functions

func AddCustomFieldsFlag

func AddCustomFieldsFlag(cmds ...*cobra.Command)

AddCustomFieldsFlag registers the standard --custom-fields-json flag.

func AddListFlags

func AddListFlags(cmd *cobra.Command)

AddListFlags adds common pagination/sorting flags to a command.

func CheckErr

func CheckErr(httpResp *http.Response, body []byte) error

CheckErr checks an HTTP response for errors using the body bytes.

func Ctx

func Ctx() context.Context

Ctx returns a background context.

func EnabledLanguages added in v0.1.1

func EnabledLanguages(defaultLang string, secondary []string) []string

EnabledLanguages returns the default language first, followed by distinct secondary languages.

func IntPtr

func IntPtr(i int) *int

IntPtr returns a pointer to an int, or nil if zero.

func NewClient

func NewClient() (*client.ClientWithResponses, config.Config, error)

NewClient creates an API client from current config, validating that token is set.

func NewClientWithAuth

func NewClientWithAuth() (*client.ClientWithResponses, config.Config, error)

NewClientWithAuth creates an API client and requires a token.

func ParseCustomFields

func ParseCustomFields(cmd *cobra.Command) (*map[string]client.CustomFieldModel, error)

func PromptExpiration added in v0.1.1

func PromptExpiration(flag string) (*string, error)

PromptExpiration resolves an API key expiry from a flag, or an interactive selector. Returns nil for no expiration.

func PromptLanguages added in v0.1.1

func PromptLanguages(defaultLang string, secondary []string) ([]string, error)

PromptLanguages resolves enabled languages from flags, or interactive selectors, falling back to DefaultLanguage.

func RefreshSession added in v0.1.1

func RefreshSession() error

RefreshSession re-mints the stored access token so newly created orgs and projects appear in its claims.

func ResolveOrgID added in v0.1.1

func ResolveOrgID(c *client.ClientWithResponses, explicit string) (string, error)

ResolveOrgID returns the organization to act on: the explicit id if given, the sole organization if there is exactly one, otherwise a prompt (TTY) or an error.

func SelectProjectAllOrgs added in v0.1.2

func SelectProjectAllOrgs(c *client.ClientWithResponses) (string, error)

SelectProjectAllOrgs opens a selector over every project in every organization the user belongs to, each labelled with its organization, and returns the chosen project id.

func SelectProjectInActiveOrg added in v0.1.2

func SelectProjectInActiveOrg(c *client.ClientWithResponses, activeID string) (*client.Tenant, error)

SelectProjectInActiveOrg opens a selector over the projects in the active project's organization, and returns the chosen project. When no project is active it falls back to selecting an organization first.

func StringPtr

func StringPtr(s string) *string

StringPtr returns a pointer to a string, or nil if empty.

func StringSlicePtr

func StringSlicePtr(s string) *[]string

StringSlicePtr returns a pointer to a string slice parsed from comma-separated input, or nil if empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

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