clipod

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: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var GetPodAction = &cli.Command{
	Name:    "pod",
	Aliases: []string{"po", "pods"},
	Action: func(ctx *cli.Context) error {
		client := util.GetClient(ctx)
		defer util.StoreClient(ctx, client)
		var showItem model.Renderer
		var err error

		switch ctx.NArg() {
		case 0:
			namespaceLabel := util.GetNamespace(ctx)
			logrus.Debugf("getting pod list from %q", namespaceLabel)
			showItem, err = client.GetPodList(namespaceLabel)
			if err != nil {
				return err
			}
		default:
			var list pod.PodList
			var gainedPod pod.Pod
			namespaceLabel := util.GetNamespace(ctx)
			logrus.Debugf("getting pods")
			for _, podName := range ctx.Args().Slice() {
				logrus.Debugf("getting %q", podName)
				gainedPod, err = client.GetPod(namespaceLabel, podName)
				if err != nil {
					return err
				}
				list = append(list, gainedPod)
			}
			showItem = list
		}
		err = util.WriteData(ctx, showItem)
		if err != nil {
			logrus.Debugf("fatal error: %v", err)
		}
		return err
	},
	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