utils

package
v0.14.0 Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2023 License: Apache-2.0 Imports: 34 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddLoggerFlags added in v0.13.0

func AddLoggerFlags(flags *pflag.FlagSet)

func AddRemote added in v0.7.11

func AddRemote(cmd *cobra.Command, name string, uri string) error

func CombineExamples

func CombineExamples(sl []Example) string

func EnsureUserSet added in v0.8.4

func EnsureUserSet(cmd *cobra.Command, c *conf.Config) error

func ErrTableNotFound added in v0.8.4

func ErrTableNotFound(db objects.Store, rs ref.Store, commit *objects.Commit) error

func GetClient added in v0.12.10

func GetClient(ctx context.Context) *http.Client

func GetCredentials added in v0.10.5

func GetCredentials(cmd *cobra.Command, cs *credentials.Store, remote string) (token string, err error)

func GetLogger added in v0.12.10

func GetLogger(cmd *cobra.Command) *logr.Logger

func GetRepoDir

func GetRepoDir(cmd *cobra.Command) *local.RepoDir

func GetRuneFromFlag added in v0.10.3

func GetRuneFromFlag(cmd *cobra.Command, flag string) (rune, error)

func GetTable added in v0.8.4

func GetTable(db objects.Store, rs ref.Store, commit *objects.Commit) (*objects.Table, error)

func GetWRGLDir

func GetWRGLDir() (string, error)

func HandleHTTPError added in v0.7.11

func HandleHTTPError(cmd *cobra.Command, cs *credentials.Store, remoteURI string, err error) error

func IsWrglhubRemote added in v0.10.3

func IsWrglhubRemote(s string) (username, reponame string, ok bool)

func MustGetRemote

func MustGetRemote(cmd *cobra.Command, c *conf.Config, name string) *conf.Remote

func MustWRGLDir

func MustWRGLDir(cmd *cobra.Command) string

func PagerOrOut

func PagerOrOut(cmd *cobra.Command) (io.Writer, func(), error)

func PrintTable

func PrintTable(w io.Writer, rows [][]string, indent int)

PrintTable prints simple table from rows of text

func Prompt

func Prompt(cmd *cobra.Command, name string) (value string, err error)

func PromptForPassword

func PromptForPassword(cmd *cobra.Command) (password string, err error)

func RepoWebURI added in v0.10.3

func RepoWebURI(username, reponame string) string

func SetClient added in v0.13.0

func SetClient(ctx context.Context, client *http.Client) context.Context

func SetLogger added in v0.13.0

func SetLogger(ctx context.Context, logger *logr.Logger) context.Context

func SetPromptValues

func SetPromptValues(ctx context.Context, values []string) context.Context

func SetupLogger added in v0.12.10

func SetupLogger(cmd *cobra.Command) (cleanup func(), err error)

func SetupProgressBarFlags added in v0.12.3

func SetupProgressBarFlags(flags *pflag.FlagSet)

func WithProgressBar added in v0.12.8

func WithProgressBar(cmd *cobra.Command, quiet bool, run func(cmd *cobra.Command, barContainer *pbar.Container) error) (err error)

WithProgressBar creates a progress bar container while buffering all cmd.Print invocations

Types

type ClientMap added in v0.10.5

type ClientMap struct {
	CredsStore *credentials.Store
	// contains filtered or unexported fields
}

func NewClientMap added in v0.10.5

func NewClientMap(cs *credentials.Store, logger logr.Logger) *ClientMap

func (*ClientMap) GetClient added in v0.10.5

func (m *ClientMap) GetClient(cmd *cobra.Command, remoteURI string, opts ...apiclient.ClientOption) (client *apiclient.Client, err error)

func (*ClientMap) GetRefs added in v0.10.5

func (m *ClientMap) GetRefs(cmd *cobra.Command, remoteURI string, opts ...apiclient.ClientOption) (refs map[string][]byte, err error)

func (*ClientMap) ResetCookies added in v0.13.2

func (m *ClientMap) ResetCookies() error

type DeviceCodeResponse added in v0.13.0

type DeviceCodeResponse struct {
	DeviceCode      string `json:"device_code"`
	UserCode        string `json:"user_code"`
	VerificationURI string `json:"verification_uri"`
	ExpiresIn       int    `json:"expires_in"`
	Interval        int    `json:"interval"`
}

type Example

type Example struct {
	Comment string
	Line    string
}

type TokenResponse added in v0.13.0

type TokenResponse struct {
	AccessToken  string `json:"access_token"`
	RefreshToken string `json:"refresh_token"`
	TokenType    string `json:"token_type"`
}

Jump to

Keyboard shortcuts

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