cli

package
v0.11.5 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2024 License: MPL-2.0 Imports: 96 Imported by: 0

Documentation

Overview

Package cli provides cli specific functionality.

Index

Constants

View Source
const (
	// ErrCurrentHeadIsOutOfDate indicates the local HEAD revision is outdated.
	ErrCurrentHeadIsOutOfDate errors.Kind = "current HEAD is out-of-date with the remote base branch"
	// ErrOutdatedGenCodeDetected indicates outdated generated code detected.
	ErrOutdatedGenCodeDetected errors.Kind = "outdated generated code detected"
)
View Source
const (

	// ErrLoginRequired is an error indicating that user has to login to the cloud.
	ErrLoginRequired errors.Kind = "cloud login required"

	// ErrIDPNeedConfirmation is an error indicating the user has multiple providers set up and
	// linking them is needed.
	ErrIDPNeedConfirmation errors.Kind = "the account was already set up with another email provider"

	// ErrEmailNotVerified is an error indicating that user's email need to be verified.
	ErrEmailNotVerified errors.Kind = "email is not verified"
)
View Source
const (
	// ProvisionerTerraform indicates that a plan was created by Terraform.
	ProvisionerTerraform = "terraform"

	// ProvisionerOpenTofu indicates that a plan was created by OpenTofu.
	ProvisionerOpenTofu = "opentofu"
)
View Source
const (
	// ErrRunFailed represents the error when the execution fails, whatever the reason.
	ErrRunFailed errors.Kind = "execution failed"

	// ErrRunCanceled represents the error when the execution was canceled.
	ErrRunCanceled errors.Kind = "execution canceled"

	// ErrRunCommandNotExecuted represents the error when the command was not executed for whatever reason.
	ErrRunCommandNotExecuted errors.Kind = "command not found"
)

Variables

This section is empty.

Functions

func Exec

func Exec(
	version string,
	args []string,
	stdin io.Reader,
	stdout io.Writer,
	stderr io.Writer,
)

Exec will execute terramate with the provided flags defined on args. Only flags should be on the args slice.

Results will be written on stdout, according to the command flags and errors/warnings written on stderr. Exec will abort the process with a status code different than zero in the case of fatal errors.

Sometimes sub commands may be executed, the provided stdin will be passed to then as the sub process stdin.

Each Exec call is completely isolated from each other (no shared state) as far as the parameters are not shared between the run calls.

Types

type APIKey added in v0.11.5

type APIKey struct {
	// contains filtered or unexported fields
}

APIKey implements the credential interface.

func (*APIKey) ApplyCredentials added in v0.11.5

func (a *APIKey) ApplyCredentials(req *http.Request) error

ApplyCredentials applies the API key to the request.

func (*APIKey) ExpireAt added in v0.11.5

func (a *APIKey) ExpireAt() time.Time

ExpireAt should never be called.

func (*APIKey) HasExpiration added in v0.11.5

func (a *APIKey) HasExpiration() bool

HasExpiration returns false because the CLI has no information about the expiration of the API key.

func (*APIKey) IsExpired added in v0.11.5

func (a *APIKey) IsExpired() bool

IsExpired returns false because the CLI has no information about the expiration of the API key.

func (*APIKey) Load added in v0.11.5

func (a *APIKey) Load() (bool, error)

Load loads the API key from the environment.

func (*APIKey) Name added in v0.11.5

func (a *APIKey) Name() string

Name returns the name of the authentication method.

func (*APIKey) RedactCredentials added in v0.11.5

func (a *APIKey) RedactCredentials(req *http.Request)

RedactCredentials redacts the API key from the request.

func (*APIKey) Token added in v0.11.5

func (a *APIKey) Token() (string, error)

Token returns the API key token.

type UIMode added in v0.4.2

type UIMode int

UIMode defines different modes of operation for the cli.

const (
	// HumanMode is the default normal mode when Terramate is executed at the user's machine.
	HumanMode UIMode = iota
	// AutomationMode is the mode when Terramate executes in the CI/CD environment.
	AutomationMode
)

Directories

Path Synopsis
Package bitbucket implements the client for Bitbucket Cloud.
Package bitbucket implements the client for Bitbucket Cloud.
Package cliconfig implements the parser and load of Terramate CLI Configuration files (.terramaterc and terramate.rc).
Package cliconfig implements the parser and load of Terramate CLI Configuration files (.terramaterc and terramate.rc).
Package clitest provides constants and errors kind reused by the cli implementation and the e2e test infrastructure.
Package clitest provides constants and errors kind reused by the cli implementation and the e2e test infrastructure.
Package github implements a client SDK for the Github API.
Package github implements a client SDK for the Github API.
Package gitlab provides a SDK and helpers for the gitlab provider.
Package gitlab provides a SDK and helpers for the gitlab provider.
Package out provides output functionality, including verboseness level and normal/error messages support.
Package out provides output functionality, including verboseness level and normal/error messages support.
Package telemetry provides types and helpers for CLI telemetry.
Package telemetry provides types and helpers for CLI telemetry.

Jump to

Keyboard shortcuts

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