status

package
v1.0.7-nightly Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Cmd = &cobra.Command{
	Use:     "status",
	Short:   "get status of your current context (user, account, environment, vpn status)",
	Example: fn.Desc("{cmd} status"),
	Run: func(_ *cobra.Command, _ []string) {

		if u, err := server.GetCurrentUser(); err == nil {
			fn.Logf("\nLogged in as %s (%s)\n",
				text.Blue(u.Name),
				text.Blue(u.Email),
			)
		}

		if s, err := client.CurrentAccountName(); err == nil {
			fn.Log(fmt.Sprint(text.Bold(text.Blue("Account: ")), s))
		}

		switch flags.CliName {
		case constants.CoreCliName:
			{
				if e, err := client.CurrentEnv(); err == nil {
					fn.Log(fmt.Sprint(text.Bold(text.Blue("Environment: ")), e.Name))
				}
			}

		case constants.InfraCliName:
			{
				if s, err := client.CurrentClusterName(); err == nil {
					fn.Log(fmt.Sprint(text.Bold(text.Blue("Cluster: ")), s))
				}
			}
		}

		if s, err := client.CurrentDeviceName(); err == nil {

			b := server.CheckDeviceStatus()
			fn.Log(fmt.Sprint(text.Bold(text.Blue("Device: ")), s, func() string {
				if b {
					return text.Bold(text.Green(" (Connected) "))
				} else {
					return text.Bold(text.Red(" (Disconnected) "))
				}
			}()))

			ip, err := client.CurrentDeviceIp()
			if err == nil {
				fn.Logf("%s %s", text.Bold(text.Blue("Device IP:")), *ip)
			}
		}
	},
}

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