commands

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2026 License: Apache-2.0 Imports: 46 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrExitZero = errors.New("awless: nothing further to report")

ErrExitZero reports that a command has already told the user everything they need and should end successfully without printing an error.

Exists so those paths can return through cobra like any other outcome instead of calling os.Exit(0) mid-call, which skipped deferred cleanup and bypassed the single exit point in main.

View Source
var ErrReported = errors.New("awless: command failed")

ErrReported marks a failure whose explanation has already been printed, usually through logger.Errorf together with a suggested command.

Returning it exits non-zero without printing a second message, which is what these paths used os.Exit(1) for. Keeping them as errors means deferred cleanup runs and there is still only one exit point.

View Source
var RootCmd = &cobra.Command{

	SilenceErrors: true,

	Use:   "awless COMMAND",
	Short: "Manage  and explore your cloud",
	Long: `awless is a powerful CLI to explore, sync and manage your cloud infrastructure.

Supported services: EC2, IAM, S3, RDS, ELBv2, Auto Scaling, Lambda, SNS, SQS, Route53,
CloudWatch, CloudFront, ECR, ECS, ACM, CloudFormation, EKS, DynamoDB, Secrets Manager,
KMS, API Gateway v2, SSM, EFS, CloudTrail, CloudWatch Logs.

Quick examples:
  awless list instances --filter state=running
  awless list loggroups --format json
  awless show my-resource
  awless create instance type=t2.micro distro=debian
  awless ssh my-instance`,
	BashCompletionFunction: bashCompletionFunc,
	RunE: func(c *cobra.Command, args []string) error {
		if versionGlobalFlag {
			printVersion(c, args)
			return nil
		}
		return c.Usage()
	},
}

Functions

func HasCmdOnelinerChilds

func HasCmdOnelinerChilds(cmd *cobra.Command) bool

func IsCmdAnnotatedOneliner

func IsCmdAnnotatedOneliner(annot map[string]string) bool

func NewRunner

func NewRunner(tpl *template.Template, msg, tplPath string, fillers ...map[string]any) *template.Runner

func NewRunnerRequiredParamsOnly

func NewRunnerRequiredParamsOnly(tpl *template.Template, msg, tplPath string, fillers ...map[string]any) *template.Runner

func RootContext

func RootContext() context.Context

RootContext returns the process context, or context.Background() if it was never set — which happens in tests that exercise commands directly.

func SetRootContext

func SetRootContext(ctx context.Context)

SetRootContext installs the process context. Called once from main.

Types

This section is empty.

Jump to

Keyboard shortcuts

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