Documentation ¶
Index ¶
- Constants
- Variables
- func AddDescriptionFlag(cmd *cobra.Command)
- func AddDescriptionVarFlag(cmd *cobra.Command, p *string)
- func AddFromGroupVarPFlag(cmd *cobra.Command, p *string)
- func AddFromProjectVarFlag(cmd *cobra.Command, p *string)
- func AddLFSenabledFlag(cmd *cobra.Command, value bool)
- func AddLFSenabledVarPFlag(cmd *cobra.Command, p *bool)
- func AddOutFlag(cmd *cobra.Command, p *string)
- func AddOwnedVarFlag(cmd *cobra.Command, p *bool)
- func AddPaginationVarFlags(cmd *cobra.Command, page *gitlab.ListOptions)
- func AddProjectOrderByVarFlag(cmd *cobra.Command, p *string)
- func AddProjectVarPFlag(cmd *cobra.Command, p *string)
- func AddRequestAccessEnabledFlag(cmd *cobra.Command, value bool)
- func AddRequestAccessEnabledVarFlag(cmd *cobra.Command, p *bool)
- func AddSearchVarFlag(cmd *cobra.Command, p *string)
- func AddSortVarFlag(cmd *cobra.Command, p *string)
- func AddStatisticsVarFlag(cmd *cobra.Command, p *bool)
- func AddVisibilityFlag(cmd *cobra.Command)
- func AddVisibilityVarFlag(cmd *cobra.Command, p *string)
- func CheckErr(err error)
- func DefaultSubCommandRun(out io.Writer) func(c *cobra.Command, args []string)
- func Error(w io.Writer, msg interface{})
- func GetFlagBool(cmd *cobra.Command, flag string) bool
- func GetFlagInt(cmd *cobra.Command, flag string) int
- func GetFlagString(cmd *cobra.Command, flag string) string
- func GetFlagStringSlice(cmd *cobra.Command, flag string) []string
- func GetFlagVisibility(cmd *cobra.Command) *gitlab.VisibilityValue
- func Load(data []byte) (*types.Config, error)
- func LoadOathWithEnvConfig() (*types.GitLabOathFormEnv, error)
- func LoadOathWithInfoConfig() (*types.GitLabOauthInfo, error)
- func NewForConfig(config *types.Config) (*gitlab.Client, error)
- func PrintBranchOut(format string, w io.Writer, branches ...*gitlab.Branch)
- func PrintFilesOut(format string, w io.Writer, trees ...*gitlab.TreeNode)
- func PrintGroupsOut(format string, w io.Writer, groups ...*gitlab.Group)
- func PrintProjectsOut(format string, w io.Writer, projects ...*gitlab.Project)
- func ReadFile(path string) ([]byte, error)
- func RequireNoArguments(c *cobra.Command, args []string)
- func StandardErrorMessage(err error) (string, bool)
- func UsageErrorf(cmd *cobra.Command, format string, args ...interface{}) error
- func VerifyMarkFlagRequired(cmd *cobra.Command, fName string)
- func WarnWordSepNormalizeFunc(f *pflag.FlagSet, name string) pflag.NormalizedName
- func WordSepNormalizeFunc(f *pflag.FlagSet, name string) pflag.NormalizedName
- type ClientConfig
- type ConfigFlags
- type DirectClientConfig
- type Factory
- type GitLabAuthorization
- type RESTClientGetter
Constants ¶
const ( // JSON is used as a constant of word "json" for out flag JSON = "json" // YAML is used as a constant of word "yaml" for out flag YAML = "yaml" )
const (
// DefaultErrorExitCode defines the default exit code.
DefaultErrorExitCode = 1
)
Variables ¶
var ErrExit = fmt.Errorf("exit")
ErrExit may be passed to CheckError to instruct it to output nothing but exit with status code 1.
Functions ¶
func AddDescriptionFlag ¶
func AddDescriptionVarFlag ¶
func AddFromGroupVarPFlag ¶
func AddFromProjectVarFlag ¶
func AddLFSenabledFlag ¶
func AddLFSenabledVarPFlag ¶
func AddOutFlag ¶
func AddOwnedVarFlag ¶
func AddPaginationVarFlags ¶
func AddProjectVarPFlag ¶
func AddSearchVarFlag ¶
func AddSortVarFlag ¶
func AddStatisticsVarFlag ¶
func AddVisibilityFlag ¶
func AddVisibilityVarFlag ¶
func CheckErr ¶
func CheckErr(err error)
CheckErr prints a user-friendly error to STDERR and exits with a non-zero exit code. Unrecognized errors will be printed with an "error: " prefix.
This method is generic to the command in use and may be used by non-IAM commands.
func DefaultSubCommandRun ¶
DefaultSubCommandRun prints a command's help string to the specified output if no arguments (sub-commands) are provided, or a usage error otherwise.
func GetFlagVisibility ¶
func GetFlagVisibility(cmd *cobra.Command) *gitlab.VisibilityValue
GetFlagVisibility converts the string flag visiblity to gitlab.VisibilityValue.
func Load ¶
Load takes a byte slice and deserializes the contents into Config object. Encapsulates deserialization without assuming the source is a file.
func LoadOathWithEnvConfig ¶
func LoadOathWithEnvConfig() (*types.GitLabOathFormEnv, error)
func LoadOathWithInfoConfig ¶
func LoadOathWithInfoConfig() (*types.GitLabOauthInfo, error)
func NewForConfig ¶
func PrintProjectsOut ¶
func RequireNoArguments ¶
RequireNoArguments exits with a usage error if extra arguments are provided.
func StandardErrorMessage ¶
StandardErrorMessage translates common errors into a human readable message, or returns false if the error is not one of the recognized types. It may also log extended information to klog.
This method is generic to the command in use and may be used by non-IAM commands.
func UsageErrorf ¶
UsageErrorf returns error with command path.
func VerifyMarkFlagRequired ¶
func WarnWordSepNormalizeFunc ¶
func WarnWordSepNormalizeFunc(f *pflag.FlagSet, name string) pflag.NormalizedName
WarnWordSepNormalizeFunc changes and warns for flags that contain "_" separators.
func WordSepNormalizeFunc ¶
func WordSepNormalizeFunc(f *pflag.FlagSet, name string) pflag.NormalizedName
WordSepNormalizeFunc changes all flags that contain "_" separators.
Types ¶
type ClientConfig ¶
type ClientConfig interface { // ClientConfig returns a complete client config ClientConfig() (*types.Config, error) }
ClientConfig is used to make it easy to get an api server client.
func NewClientConfigFromBytes ¶
func NewClientConfigFromBytes(configBytes []byte) (ClientConfig, error)
NewClientConfigFromBytes takes your glctl config and gives you back a ClientConfig.
func NewClientConfigFromConfig ¶
func NewClientConfigFromConfig(oathInfo *types.GitLabOauthInfo, oathEnv *types.GitLabOathFormEnv) ClientConfig
NewClientConfigFromConfig takes your Config and gives you back a ClientConfig.
type ConfigFlags ¶
type ConfigFlags struct { Env *types.GitLabOathFormEnv Oath *types.GitLabOauthInfo // contains filtered or unexported fields }
func NewConfigFlags ¶
func NewConfigFlags(usePersistentConfig bool) *ConfigFlags
NewConfigFlags returns ConfigFlags with default values set.
func (*ConfigFlags) AddFlags ¶
func (f *ConfigFlags) AddFlags(flags *pflag.FlagSet)
AddConfig binds client configuration flags to a given flagset.
func (*ConfigFlags) ToRESTConfig ¶
func (f *ConfigFlags) ToRESTConfig() (*types.Config, error)
func (*ConfigFlags) ToRawGLConfigLoader ¶
func (f *ConfigFlags) ToRawGLConfigLoader() ClientConfig
ToRawGLConfigLoader binds config flag values to config overrides Returns an interactive clientConfig if the password flag is enabled, or a non-interactive clientConfig otherwise.
type DirectClientConfig ¶
type DirectClientConfig struct {
// contains filtered or unexported fields
}
DirectClientConfig wrap for Config.
func (*DirectClientConfig) ClientConfig ¶
func (config *DirectClientConfig) ClientConfig() (*types.Config, error)
type Factory ¶
type Factory interface { // GitlabClient gives you back an external gitlabClient GitlabClient() (*gitlab.Client, error) }
func NewFactory ¶
func NewFactory(clientGetter RESTClientGetter) Factory
type GitLabAuthorization ¶
func (*GitLabAuthorization) HasAuth ¶
func (g *GitLabAuthorization) HasAuth() bool
func (*GitLabAuthorization) HasBasicAuth ¶
func (g *GitLabAuthorization) HasBasicAuth() bool
func (*GitLabAuthorization) HasOathAuth ¶
func (g *GitLabAuthorization) HasOathAuth() bool
func (*GitLabAuthorization) HasPasswordAuth ¶
func (g *GitLabAuthorization) HasPasswordAuth() bool
type RESTClientGetter ¶
type RESTClientGetter interface { // ToRESTConfig returns restconfig ToRESTConfig() (*types.Config, error) // ToRawGlConfigLoader return GLconfig loader as-is ToRawGLConfigLoader() ClientConfig }