cmdutil

package
v0.197.0 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2024 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ActionRequestedExitCode = 1
	FatalErrExitCode        = 2
)
View Source
const ApplicationURL = "https://app.planetscale.com"
View Source
const WarnAuthMessage = "not authenticated yet. Please run 'pscale auth login'"

Variables

This section is empty.

Functions

func CheckAuthentication added in v0.15.0

func CheckAuthentication(cfg *config.Config) func(cmd *cobra.Command, args []string) error

CheckAuthentication checks whether the user is authenticated and returns a actionable error message.

func DeployRequestBranchToNumber added in v0.149.0

func DeployRequestBranchToNumber(ctx context.Context, client *ps.Client, organization string, database string, branch string, state string) (uint64, error)

func ErrCode added in v0.12.0

func ErrCode(err error) planetscale.ErrorCode

ErrCode returns the code from a *planetscale.Error, if available. If the error is not of type *planetscale.Error or is nil, it returns an empty, undefined error code.

func HandleError added in v0.21.1

func HandleError(err error) error

HandleError checks whether the given err is an *planetscale.Error and returns a descriptive, human readable error if the error code matches a certain planetscale Error types. If the error doesn't match these requirements, err is returned unmodified.

func HasHomebrew added in v0.31.0

func HasHomebrew() bool

HasHomebrew check whether the user has installed brew

func IsUnderHomebrew added in v0.31.0

func IsUnderHomebrew(binpath string) bool

IsUnderHomebrew checks whether the given binary is under the homebrew path. copied from: https://github.com/cli/cli/blob/trunk/cmd/gh/main.go#L298

func MySQLClientPath added in v0.31.0

func MySQLClientPath() (string, error)

MySQLClientPath checks whether the 'mysql' client exists and returns the path to the binary. The returned error contains instructions to install the client.

func NewZapLogger added in v0.17.1

func NewZapLogger(debug bool) *zap.Logger

NewZapLogger returns a logger to be used with the sql-proxy. By default it only outputs error leveled messages, unless debug is true.

func OpenBrowser

func OpenBrowser(goos, url string) *exec.Cmd

OpenBrowser opens a web browser at the specified url.

func ParseSSLMode added in v0.100.0

func ParseSSLMode(sslMode string) ps.ExternalDataSourceSSLVerificationMode

func RequiredArgs added in v0.3.1

func RequiredArgs(reqArgs ...string) cobra.PositionalArgs

required arguments are not available.

func TimeToMilliseconds added in v0.131.0

func TimeToMilliseconds(t time.Time) int64

Types

type Error added in v0.42.0

type Error struct {
	Msg string
	// Status
	ExitCode int
}

Error can be used by a command to change the exit status of the CLI.

func (*Error) Error added in v0.42.0

func (e *Error) Error() string

type Helper added in v0.14.0

type Helper struct {
	// Config contains globally sourced configuration
	Config *config.Config

	ConfigFS *config.ConfigFS

	// Client returns the PlanetScale API client
	Client func() (*ps.Client, error)

	// Printer is used to print output of a command to stdout.
	Printer *printer.Printer
	// contains filtered or unexported fields
}

Helper is passed to every single command and is used by individual subcommands.

func (*Helper) Debug added in v0.18.0

func (h *Helper) Debug() bool

func (*Helper) SetDebug added in v0.24.0

func (h *Helper) SetDebug(debug *bool)

type PasswordRole added in v0.90.0

type PasswordRole int
const (
	ReaderRole PasswordRole = iota
	WriterRole
	ReadWriterRole
	AdministratorRole
)

func RoleFromString added in v0.90.0

func RoleFromString(r string) (PasswordRole, error)

func (PasswordRole) ToString added in v0.90.0

func (r PasswordRole) ToString() string

Jump to

Keyboard shortcuts

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