cat

package
v1.7.3 Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2023 License: Apache-2.0 Imports: 7 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Example (Cat_help)
package main

import (
	"os"

	"github.com/aws-cloudformation/rain/internal/cmd/cat"
)

func main() {
	os.Args = []string{
		os.Args[0],
		"--help",
	}

	cat.Cmd.Execute()
}
Output:
Downloads the template used to deploy <stack> and prints it to stdout.

Usage:
  cat <stack>

Flags:
  -h, --help          help for cat
  -t, --transformed   get the template with transformations applied by CloudFormation
  -u, --unformatted   output the template in its raw form; do not attempt to format it

Index

Examples

Constants

This section is empty.

Variables

View Source
var Cmd = &cobra.Command{
	Use:                   "cat <stack>",
	Short:                 "Get the CloudFormation template from a running stack",
	Long:                  "Downloads the template used to deploy <stack> and prints it to stdout.",
	Args:                  cobra.ExactArgs(1),
	DisableFlagsInUseLine: true,
	Run: func(cmd *cobra.Command, args []string) {
		stackName := args[0]

		spinner.Push(fmt.Sprintf("Getting template from stack '%s'", stackName))
		template, err := cfn.GetStackTemplate(stackName, transformed)
		if err != nil {
			panic(ui.Errorf(err, "failed to get template for stack '%s'", stackName))
		}
		spinner.Pop()

		if unformatted {
			fmt.Println(template)
		} else {
			t, err := parse.String(template)
			if err != nil {
				panic(ui.Errorf(err, "failed to parse template for stack '%s'", stackName))
			}

			fmt.Print(format.String(t, format.Options{}))
		}
	},
}

Cmd is the cat command's entrypoint

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

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