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 DetermineEditor(cf func() (config.Config, error)) (string, error)
- func DisableAuthCheck(cmd *cobra.Command)
- func DisableAuthCheckFlag(flag *pflag.Flag)
- func EnableRepoOverride(cmd *cobra.Command, f *Factory)
- func ExactArgs(n int, msg string) cobra.PositionalArgs
- func FlagErrorWrap(err error) error
- func FlagErrorf(format string, args ...interface{}) error
- func IsAuthCheckEnabled(cmd *cobra.Command) 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 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 OverrideBaseRepoFunc(f *Factory, override string) func() (ghrepo.Interface, error)
- func ReadFile(filename string, stdin io.ReadCloser) ([]byte, error)
- func RegisterBranchCompletionFlags(gitc gitClient, cmd *cobra.Command, flags ...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
- func StructExportData(s interface{}, fields []string) map[string]interface{}
- type Exporter
- type Factory
- type FlagError
- type JSONFlagError
- type NoResultsError
Constants ¶
This section is empty.
Variables ¶
var CancelError = errors.New("CancelError")
CancelError signals user-initiated cancellation
var PendingError = errors.New("PendingError")
PendingError signals nothing failed but something is pending
var SilentError = errors.New("SilentError")
SilentError is an error that triggers exit code 1 without any error messaging
Functions ¶
func AddFormatFlags ¶ added in v2.42.0
func DetermineEditor ¶
TODO: consider passing via Factory TODO: support per-hostname settings
func DisableAuthCheck ¶
func DisableAuthCheckFlag ¶ added in v2.49.0
func EnableRepoOverride ¶
func FlagErrorWrap ¶ added in v2.2.0
FlagError returns a new FlagError that wraps the specified error.
func FlagErrorf ¶ added in v2.2.0
FlagErrorf returns a new FlagError that wraps an error produced by fmt.Errorf(format, args...).
func IsAuthCheckEnabled ¶
func IsUserCancellation ¶
func MinimumArgs ¶
func MinimumArgs(n int, msg string) cobra.PositionalArgs
func MutuallyExclusive ¶
func NewJSONExporter ¶ added in v2.42.0
func NewJSONExporter() *jsonExporter
NewJSONExporter returns an Exporter to emit JSON.
func NilBoolFlag ¶ added in v2.4.0
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 ¶ added in v2.4.0
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 OverrideBaseRepoFunc ¶
func RegisterBranchCompletionFlags ¶ added in v2.26.0
RegisterBranchCompletionFlags suggests and autocompletes known remote git branches for flags passed
func StringEnumFlag ¶ added in v2.5.2
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 ¶ added in v2.6.0
func StructExportData ¶ added in v2.43.0
Basic function that can be used with structs that need to implement the exportable interface. It has numerous limitations so verify that it works as expected with the struct and fields you want to export. If it does not, then implementing a custom ExportData method is necessary. Perhaps this should be moved up into exportData for the case when a struct does not implement the exportable interface, but for now it will need to be explicitly used.
Types ¶
type Factory ¶
type Factory struct { AppVersion string ExecutableName string Browser browser.Browser ExtensionManager extensions.ExtensionManager GitClient *git.Client IOStreams *iostreams.IOStreams Prompter prompter.Prompter BaseRepo func() (ghrepo.Interface, error) Branch func() (string, error) Config func() (config.Config, error) HttpClient func() (*http.Client, error) Remotes func() (context.Remotes, error) }
func (*Factory) Executable ¶
Executable is the path to the currently invoked binary
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.
type JSONFlagError ¶
type JSONFlagError struct {
// contains filtered or unexported fields
}
type NoResultsError ¶ added in v2.9.0
type NoResultsError struct {
// contains filtered or unexported fields
}
func NewNoResultsError ¶ added in v2.9.0
func NewNoResultsError(message string) NoResultsError
func (NoResultsError) Error ¶ added in v2.9.0
func (e NoResultsError) Error() string