catapult

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2021 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Command = &cli.Command{
	Name:  "catapult",
	Usage: "connect Kubernetes services",

	Category: app.CategoryCluster,

	Flags: []cli.Flag{
		app.ScopeFlag,
		app.NamespaceFlag,
	},

	Action: func(c *cli.Context) error {
		client := app.MustClient(c)

		scope := app.Scope(c)
		namespace := app.Namespace(c)

		elevated, err := system.IsElevated()

		if err != nil {
			return err
		}

		if !elevated {
			args := []string{
				os.Args[0],
				"catapult",
			}

			if namespace != "" {
				args = append(args, "--"+app.NamespaceFlag.Name, namespace)
			}

			if scope != "" {
				args = append(args, "--"+app.ScopeFlag.Name, scope)
			}

			os.Args = args

			if err := system.RunElevated(); err != nil {
				cli.Fatal("This command must be run as root!")
			}

			os.Exit(0)
		}

		return startCatapult(c.Context, client, namespace, scope)
	},
}

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