cmdutil

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2024 License: MIT Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

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

CancelError signals user-initiated cancellation

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

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

Functions

func AddJSONFlags

func AddJSONFlags(cmd *cobra.Command, exportTarget *Exporter, fields []string)

func CheckAuth

func CheckAuth(cfg config.Config) bool

CheckAuth checks if the default hostname has an access token assigned (without validating it).

func DisableAuthCheck

func DisableAuthCheck(cmd *cobra.Command)

func ExactArgs

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

func FlagErrorWrap

func FlagErrorWrap(err error) error

FlagError returns a new FlagError that wraps the specified error.

func FlagErrorf

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

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

func GenTable

func GenTable(columns []string, data [][]string) string

GenTable generates a Markdown table as a string.

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 NoArgsQuoteReminder

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

func P

func P(io *iostreams.IOStreams, txt string, args ...interface{})

P is a shorthand for print and heredoc.

func PrintMarkdown

func PrintMarkdown(io *iostreams.IOStreams, md string) error

func ReadFile

func ReadFile(filename string, stdin io.ReadCloser) ([]byte, error)

Types

type Browser

type Browser interface {
	Browse(string) error
}

func NewBrowser

func NewBrowser(launcher string, stdout, stderr io.Writer) Browser

type Exporter

type Exporter interface {
	Fields() []string
	Write(io *iostreams.IOStreams, data interface{}) error
}

type Factory

type Factory struct {
	IOStreams *iostreams.IOStreams
	Browser   Browser

	HTTPClient func() (*http.Client, error)
	Config     func() (config.Config, error)

	// Executable is the path to the currently invoked inst binary
	Executable func() string
}

type FlagError

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.

func (*FlagError) Error

func (fe *FlagError) Error() string

func (*FlagError) Unwrap

func (fe *FlagError) Unwrap() error

type JSONFlagError

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

type TestBrowser

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

func (*TestBrowser) Browse

func (b *TestBrowser) Browse(url string) error

func (*TestBrowser) BrowsedURL

func (b *TestBrowser) BrowsedURL() string

func (*TestBrowser) Verify

func (b *TestBrowser) Verify(t _testing, url string)

Jump to

Keyboard shortcuts

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