clinamespace

package
v3.0.0-alpha+incompatible Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2018 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Delete = &cli.Command{
	Name:        "namespace",
	Usage:       "call to delete namespace",
	Description: "delete namespace deletes namespace with name, provided by first arg. Aliases: " + strings.Join(aliases, ", "),
	UsageText:   "chkit delete namespace",
	Aliases:     aliases,
	Flags:       util.DeleteFlags,
	Action: func(ctx *cli.Context) error {
		logrus.Debugf("running command delete namespace")
		client := util.GetClient(ctx)
		if ctx.NArg() == 0 {
			logrus.Debugf("show help")
			return cli.ShowSubcommandHelp(ctx)
		}
		namespace := ctx.Args().First()
		logrus.Debugf("deleting namespace %q", namespace)
		err := client.DeleteNamespace(namespace)
		return err
	},
}
View Source
var GetNamespace = &cli.Command{
	Name:        "namespace",
	Aliases:     aliases,
	Description: `shows namespace data or namespace list. Aliases: ` + strings.Join(aliases, ", "),
	Usage:       `shows namespace data or namespace list`,
	UsageText:   "chkit get namespace_name... [-o yaml/json] [-f output_file]",
	Action: func(ctx *cli.Context) error {
		client := util.GetClient(ctx)
		defer util.StoreClient(ctx, client)
		var showItem model.Renderer
		var err error

		anime := &animation.Animation{
			Framerate:      0.2,
			ClearLastFrame: true,
			Source:         trasher.NewSilly(),
		}
		go func() {
			time.Sleep(time.Second)
			anime.Run()
		}()
		switch ctx.NArg() {
		case 1:
			namespaceLabel := ctx.Args().First()
			logrus.Debugf("getting namespace %q", namespaceLabel)
			showItem, err = client.GetNamespace(namespaceLabel)
			if err != nil {
				logrus.Debugf("fatal error: %v", err)
				anime.Stop()
				return err
			}
		default:
			var list namespace.NamespaceList
			logrus.Debugf("getting namespace list")
			list, err := client.GetNamespaceList()
			if err != nil {
				logrus.Debugf("fatal error: %v", err)
				anime.Stop()
				return err
			}
			showItem = list
		}
		logrus.Debugf("stopping animation")
		anime.Stop()
		logrus.Debugf("List recieved")
		err = util.ExportDataCommand(ctx, showItem)
		if err != nil {
			logrus.Debugf("fatal error: %v", err)
		}
		return err
	},
	Flags: util.GetFlags,
}

GetNamespace -- commmand 'get' entity data

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