clideployment

package
v3.0.0-beta+incompatible Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2018 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNoNamespaceSpecified chkitErrors.Err = "no namespace specified"
)
View Source
var GetDeployment = &cli.Command{
	Name:      "deployment",
	Aliases:   []string{"depl", "deployments", "deploy"},
	Usage:     "shows deployment data",
	ArgsUsage: "namespace [deployment_names ...]",
	Action: func(ctx *cli.Context) error {
		if ctx.Bool("help") {
			return cli.ShowSubcommandHelp(ctx)
		}
		client := util.GetClient(ctx)
		defer util.StoreClient(ctx, client)

		var show model.Renderer
		switch ctx.NArg() {
		case 0:
			namespace := util.GetNamespace(ctx)
			logrus.Debugf("getting deployment from %q", namespace)
			list, err := client.GetDeploymentList(namespace)
			if err != nil {
				return err
			}
			show = list
		default:
			namespace := util.GetNamespace(ctx)
			deplNames := newSet(ctx.Args().Slice())
			var showList deployment.DeploymentList = make([]deployment.Deployment, 0) // prevents panic
			list, err := client.GetDeploymentList(namespace)
			if err != nil {
				return err
			}
			for _, depl := range list {
				if deplNames.Contain(depl.Name) {
					showList = append(showList, depl)
				}
			}
			show = showList
		}
		return util.WriteData(ctx, show)
	},
	Flags: []cli.Flag{
		&cli.StringFlag{
			Name:    "file",
			Aliases: []string{"f"},
		},
		&cli.StringFlag{
			Name:    "output",
			Aliases: []string{"o"},
		},
	},
}

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