Documentation
¶
Index ¶
- Variables
- func AddFormatFlags(cmd *cobra.Command, exportTarget *Exporter)
- func AddGroup(parent *cobra.Command, title string, cmds ...*cobra.Command)
- func AddJSONFlags(cmd *cobra.Command, exportTarget *Exporter, fields []string)
- func CheckAuth(cfg config.Config) bool
- func DisableAuthCheck(cmd *cobra.Command)
- func EnableRepoOverride(ctx CmdContext, cmds ...*cobra.Command)
- func ExactArgs(n int, msg string) cobra.PositionalArgs
- func FlagErrorWrap(err error) error
- func FlagErrorf(format string, args ...any) error
- func IsAuthCheckEnabled(cmd *cobra.Command) bool
- func IsNotFoundError(err error) bool
- func IsUserCancellation(err error) bool
- func MinimumArgs(n int, msg string) cobra.PositionalArgs
- func MutuallyExclusive(message string, conditions ...bool) error
- func NewJSONExporter() *jsonExporter
- func NewPatAuthenticator(cfg config.Config) (instance azdo.Authenticator, err error)
- func NilBoolFlag(cmd *cobra.Command, p **bool, name string, shorthand string, usage string) *pflag.Flag
- func NilStringFlag(cmd *cobra.Command, p **string, name string, shorthand string, usage string) *pflag.Flag
- func NoArgsQuoteReminder(cmd *cobra.Command, args []string) error
- func ParseOrganizationArg(ctx CmdContext, arg string) (string, error)
- func ReadFile(filename string, stdin io.ReadCloser) ([]byte, error)
- func RegisterBranchCompletionFlags(gitc gitClient, cmd *cobra.Command, flags ...string) error
- func ResolveScopeDescriptor(ctx CmdContext, organization, project string) (*string, *string, error)
- func StringEnumFlag(cmd *cobra.Command, p *string, name, shorthand, defaultValue string, ...) *pflag.Flag
- func StringSliceEnumFlag(cmd *cobra.Command, p *[]string, name, shorthand string, ...) *pflag.Flag
- type CmdContext
- type Exporter
- type ExternalCommandExitError
- type FlagError
- type JSONFlagError
- type NoResultsError
- type RepoContext
- type Scope
- type Target
Constants ¶
This section is empty.
Variables ¶
var ErrCancel = errors.New("CancelError")
ErrCancel signals user-initiated cancellation
var ErrNotImplemented = errors.New("NotImplementedError")
ErrNotImplemented is an error that indicates a feature is not implemented
var ErrSilent = errors.New("SilentError")
ErrSilent is an error that triggers exit code 1 without any error messaging
Functions ¶
func AddFormatFlags ¶ added in v0.1.0
func AddJSONFlags ¶ added in v0.1.0
func DisableAuthCheck ¶
func EnableRepoOverride ¶ added in v0.1.0
func EnableRepoOverride(ctx CmdContext, cmds ...*cobra.Command)
func FlagErrorWrap ¶
FlagError returns a new FlagError that wraps the specified error.
func FlagErrorf ¶
FlagErrorf returns a new FlagError that wraps an error produced by fmt.Errorf(format, args...).
func IsAuthCheckEnabled ¶
func IsNotFoundError ¶ added in v0.1.0
IsNotFoundError checks if the given error is an Azure DevOps API "Not Found" (HTTP 404) error.
func IsUserCancellation ¶
func MinimumArgs ¶
func MinimumArgs(n int, msg string) cobra.PositionalArgs
func MutuallyExclusive ¶
func NewJSONExporter ¶ added in v0.1.0
func NewJSONExporter() *jsonExporter
NewJSONExporter returns an Exporter to emit JSON.
func NewPatAuthenticator ¶
func NewPatAuthenticator(cfg config.Config) (instance azdo.Authenticator, err error)
func NilBoolFlag ¶
func NilBoolFlag(cmd *cobra.Command, p **bool, name string, shorthand string, usage string) *pflag.Flag
NilBoolFlag defines a new flag with a bool pointer receiver. This is useful for differentiating between the flag being explicitly set to a false value and the flag not being passed at all.
func NilStringFlag ¶
func NilStringFlag(cmd *cobra.Command, p **string, name string, shorthand string, usage string) *pflag.Flag
NilStringFlag defines a new flag with a string pointer receiver. This is useful for differentiating between the flag being set to a blank value and the flag not being passed at all.
func ParseOrganizationArg ¶ added in v0.6.0
func ParseOrganizationArg(ctx CmdContext, arg string) (string, error)
ParseOrganizationArg resolves the organization from an input argument of the form "[ORGANIZATION]". When the input is empty, the default organization from the user configuration is returned.
func RegisterBranchCompletionFlags ¶
RegisterBranchCompletionFlags suggests and autocompletes known remote git branches for flags passed
func ResolveScopeDescriptor ¶ added in v0.5.0
func ResolveScopeDescriptor(ctx CmdContext, organization, project string) (*string, *string, error)
ResolveScopeDescriptor fetches the descriptor representing the project scope when a project is supplied. It returns the descriptor value along with the project ID string to support callers that need to distinguish between identically named groups scoped to different projects.
Types ¶
type CmdContext ¶
type CmdContext interface {
util.ContextAware
RepoContext() RepoContext
ConnectionFactory() azdo.ConnectionFactory
ClientFactory() azdo.ClientFactory
Prompter() (prompter.Prompter, error)
Config() (config.Config, error)
IOStreams() (*iostreams.IOStreams, error)
Printer(string) (printer.Printer, error)
}
func NewCmdContext ¶
func NewCmdContext() (ctx CmdContext, err error)
type ExternalCommandExitError ¶ added in v0.0.2
type ExternalCommandExitError struct {
// contains filtered or unexported fields
}
func NewExternalCommandExitError ¶
func NewExternalCommandExitError(err *exec.ExitError) ExternalCommandExitError
func (ExternalCommandExitError) Error ¶ added in v0.0.2
func (e ExternalCommandExitError) Error() string
func (ExternalCommandExitError) ExitCode ¶ added in v0.0.2
func (e ExternalCommandExitError) ExitCode() int
type FlagError ¶ added in v0.0.2
type FlagError struct {
// contains filtered or unexported fields
}
A *FlagError indicates an error processing command-line flags or other arguments. Such errors cause the application to display the usage message.
type JSONFlagError ¶ added in v0.1.0
type JSONFlagError struct {
// contains filtered or unexported fields
}
type NoResultsError ¶ added in v0.0.2
type NoResultsError struct {
// contains filtered or unexported fields
}
func NewNoResultsError ¶
func NewNoResultsError(message string) NoResultsError
func (NoResultsError) Error ¶ added in v0.0.2
func (e NoResultsError) Error() string
func (NoResultsError) Is ¶ added in v0.1.0
func (e NoResultsError) Is(target error) bool
Is allows errors.Is to match any NoResultsError regardless of message content.
type RepoContext ¶ added in v0.1.0
type RepoContext interface {
util.ContextAware
GitCommand() (git.GitCommand, error)
Remotes() (azdo.RemoteSet, error)
Remote(*azdogit.GitRepository) (*azdo.Remote, error)
WithRepo(func() (azdo.Repository, error)) RepoContext
Repo() (azdo.Repository, error)
GitClient() (azdogit.Client, error)
GitRepository() (*azdogit.GitRepository, error)
}
type Scope ¶ added in v0.5.0
Scope describes the organization/project resolution for commands that accept optional project scope.
func ParseProjectScope ¶ added in v0.6.0
func ParseProjectScope(ctx CmdContext, arg string) (*Scope, error)
ParseProjectScope parses arguments in the form [ORGANIZATION/]PROJECT. When the organization segment is omitted the default organization from the user's configuration is used. The function trims whitespace around individual segments and ensures the resulting values are non-empty.
func ParseScope ¶ added in v0.5.0
func ParseScope(ctx CmdContext, scope string) (*Scope, error)
ParseScope resolves the organization and optional project from an input argument of the form "[ORGANIZATION[/PROJECT]]". When the input is empty, the default organization from the user configuration is returned. The function trims whitespace around individual segments and ensures the resulting values are non-empty when provided.
type Target ¶ added in v0.6.0
func ParseProjectTargetWithDefaultOrganization ¶ added in v0.6.0
func ParseProjectTargetWithDefaultOrganization(ctx CmdContext, target string) (*Target, error)
ParseProjectTargetWithDefaultOrganization resolves targets that must include a project segment. It accepts arguments in the form [ORGANIZATION/]PROJECT/TARGET, falling back to the user's default organization when the organization segment is omitted.
func ParseTarget ¶ added in v0.6.0
ParseTarget validates and parses a target argument of form ORGANIZATION/TARGET or ORGANIZATION/PROJECT/TARGET.
func ParseTargetWithDefaultOrganization ¶ added in v0.6.0
func ParseTargetWithDefaultOrganization(ctx CmdContext, target string) (*Target, error)
ParseTargetWithDefaultOrganization resolves a group-oriented target that allows an implicit organization by falling back to the configured default. Accepted formats are [ORGANIZATION/]GROUP and [ORGANIZATION/]PROJECT/GROUP (used by security membership commands where the middle segment is optional).