util

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2023 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrCancel = errors.New("CancelError")

CancelError signals user-initiated cancellation

View Source
var ErrSilent = errors.New("SilentError")

SilentError is an error that triggers exit code 1 without any error messaging

Functions

func CheckAuth

func CheckAuth(cfg config.Config) bool

func DisableAuthCheck

func DisableAuthCheck(cmd *cobra.Command)

func ExactArgs

func ExactArgs(n int, msg string) cobra.PositionalArgs

func FlagErrorWrap

func FlagErrorWrap(err error) error

ErrFlag returns a new ErrFlag that wraps the specified error.

func FlagErrorf

func FlagErrorf(format string, args ...interface{}) error

FlagErrorf returns a new ErrFlag that wraps an error produced by fmt.Errorf(format, args...).

func IsAuthCheckEnabled

func IsAuthCheckEnabled(cmd *cobra.Command) bool

func IsUserCancellation

func IsUserCancellation(err error) bool

func MinimumArgs

func MinimumArgs(n int, msg string) cobra.PositionalArgs

func MutuallyExclusive

func MutuallyExclusive(message string, conditions ...bool) 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 NoArgsQuoteReminder

func NoArgsQuoteReminder(cmd *cobra.Command, args []string) error

func RegisterBranchCompletionFlags

func RegisterBranchCompletionFlags(gitc gitClient, cmd *cobra.Command, flags ...string) error

RegisterBranchCompletionFlags suggests and autocompletes known remote git branches for flags passed

func StringEnumFlag

func StringEnumFlag(cmd *cobra.Command, p *string, name, shorthand, defaultValue string, options []string, usage string) *pflag.Flag

StringEnumFlag defines a new string flag that only allows values listed in options.

func StringSliceEnumFlag

func StringSliceEnumFlag(cmd *cobra.Command, p *[]string, name, shorthand string, defaultValues, options []string, usage string) *pflag.Flag

Types

type Authenticator

type Authenticator interface {
	GetAuthorizationHeader(host string) (string, error)
}

func NewPatAuthenticator

func NewPatAuthenticator(cfg config.Config) (instance Authenticator, err error)

type CmdContext

type CmdContext interface {
	Prompter() (prompter.Prompter, error)
	Context() (context.Context, error)
	Config() (config.Config, error)
	Connection(organization string) (*azuredevops.Connection, error)
	IOStreams() (*iostreams.IOStreams, error)
	TablePrinter() (tableprinter.TablePrinter, error)
	GitClient() (*git.Client, error)
}

func NewCmdContext

func NewCmdContext() (ctx CmdContext, err error)

type ErrExternalCommandExit

type ErrExternalCommandExit struct {
	// contains filtered or unexported fields
}

func NewExternalCommandExitError

func NewExternalCommandExitError(err *exec.ExitError) ErrExternalCommandExit

func (ErrExternalCommandExit) Error

func (e ErrExternalCommandExit) Error() string

func (ErrExternalCommandExit) ExitCode

func (e ErrExternalCommandExit) ExitCode() int

type ErrFlag

type ErrFlag struct {
	// contains filtered or unexported fields
}

A *ErrFlag indicates an error processing command-line flags or other arguments. Such errors cause the application to display the usage message.

func (*ErrFlag) Error

func (fe *ErrFlag) Error() string

func (*ErrFlag) Unwrap

func (fe *ErrFlag) Unwrap() error

type ErrNoResults

type ErrNoResults struct {
	// contains filtered or unexported fields
}

func NewNoResultsError

func NewNoResultsError(message string) ErrNoResults

func (ErrNoResults) Error

func (e ErrNoResults) Error() string

Jump to

Keyboard shortcuts

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