cli

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: May 14, 2024 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrFreeClusterAlreadyExists = errors.New("this project already has another free cluster. To learn how to create non-free clusters, run \"atlas cluster create --help\"")
View Source
var ErrMissingOrgID = fmt.Errorf(requiredF, flag.OrgID)
View Source
var ErrNameExists = errors.New(`the name already exists. Please run "atlas cluster list" to review existing cluster names`)
View Source
var ErrNoRegionExistsTryCommand = errors.New(`the region does not exist. To find the available regions, run "atlas cluster availableRegions list"`)

Functions

func GenerateAliases

func GenerateAliases(use string, extra ...string) []string

GenerateAliases return aliases for use such that they are: a version all lower case, a version with dashes, a singular versions with the same rules.

func ReturnValueForSetting

func ReturnValueForSetting(enableFlag, disableFlag bool) *bool

ReturnValueForSetting returns a boolean value that is useful when working with boolean flags to inform whether the given option should be active or inactive.

Types

type AutoFunc

type AutoFunc func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective)

type DeleteOpts

type DeleteOpts struct {
	Entry   string
	Confirm bool
	// contains filtered or unexported fields
}

DeleteOpts options required when deleting a resource. A command can compose this struct and then safely rely on the methods Prompt, or Delete to manage the interactions with the user.

func NewDeleteOpts

func NewDeleteOpts(successMsg, failMsg string) *DeleteOpts

func (*DeleteOpts) Delete

func (opts *DeleteOpts) Delete(d interface{}, a ...string) error

Delete deletes a resource not associated to a project, it expects a callback that should perform the deletion from the store.

func (*DeleteOpts) FailMessage

func (opts *DeleteOpts) FailMessage() string

FailMessage gets the set fail message or the default value.

func (*DeleteOpts) Prompt

func (opts *DeleteOpts) Prompt() error

Prompt confirms that the resource should be deleted.

func (*DeleteOpts) PromptWithMessage

func (opts *DeleteOpts) PromptWithMessage(message string) error

PromptWithMessage confirms that the resource should be deleted.

func (*DeleteOpts) SuccessMessage

func (opts *DeleteOpts) SuccessMessage() string

SuccessMessage gets the set success message or the default value.

type GlobalOpts

type GlobalOpts struct {
	OrgID     string
	ProjectID string
}

func (*GlobalOpts) ConfigOrgID

func (opts *GlobalOpts) ConfigOrgID() string

ConfigOrgID returns the organization id. If the id is empty, it caches it after querying config.

func (*GlobalOpts) ConfigProjectID

func (opts *GlobalOpts) ConfigProjectID() string

ConfigProjectID returns the project id. If the id is empty, it caches it after querying config.

func (*GlobalOpts) PreRunE

func (*GlobalOpts) PreRunE(cbs ...prerun.CmdOpt) error

func (*GlobalOpts) ValidateOrgID

func (opts *GlobalOpts) ValidateOrgID() error

ValidateOrgID validates orgID.

func (*GlobalOpts) ValidateProjectID

func (opts *GlobalOpts) ValidateProjectID() error

ValidateProjectID validates projectID.

type OutputOpts

type OutputOpts struct {
	Template  string
	OutWriter io.Writer
	Output    string
}

func (*OutputOpts) AutoCompleteOutputFlag

func (*OutputOpts) AutoCompleteOutputFlag() func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective)

func (*OutputOpts) ConfigOutput

func (opts *OutputOpts) ConfigOutput() string

ConfigOutput returns the output format. If the format is empty, it caches it after querying config.

func (*OutputOpts) ConfigWriter

func (opts *OutputOpts) ConfigWriter() io.Writer

ConfigWriter returns the io.Writer. If the writer is nil, it defaults to os.Stdout and caches it.

func (*OutputOpts) InitOutput

func (opts *OutputOpts) InitOutput(w io.Writer, t string) func() error

InitOutput allow to init the OutputOpts in a functional way.

func (*OutputOpts) IsCygwinTerminal

func (opts *OutputOpts) IsCygwinTerminal() bool

IsCygwinTerminal returns true is the current file descriptor is cygwin.

func (*OutputOpts) IsGoTemplate

func (opts *OutputOpts) IsGoTemplate() bool

func (*OutputOpts) IsJSONOutput

func (opts *OutputOpts) IsJSONOutput() bool

func (*OutputOpts) IsJSONPathOutput

func (opts *OutputOpts) IsJSONPathOutput() bool

func (*OutputOpts) IsPlainOutput

func (opts *OutputOpts) IsPlainOutput() bool

func (*OutputOpts) IsTerminal

func (opts *OutputOpts) IsTerminal() bool

IsTerminal returns true is the current file descriptor is TTY kind of terminal.

func (*OutputOpts) Print

func (opts *OutputOpts) Print(o interface{}) error

Print will evaluate the defined format and try to parse it accordingly outputting to the set writer.

func (*OutputOpts) PrintForCompactResultsResponse

func (opts *OutputOpts) PrintForCompactResultsResponse(o interface{}) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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