whoami

package
v0.0.0-...-493bf59 Latest Latest
Warning

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

Go to latest
Published: Jun 1, 2021 License: Apache-2.0 Imports: 5 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Cmd = models.Command{
	Name:      "whoami",
	ShortHelp: "Retrieve your user ID",
	LongHelp: "<code>whoami</code> prints out the currently logged in user's users ID. " +
		"This is used with Datica support engineers. Here is a sample command\n\n" +
		"<pre>\ndatica whoami\n</pre>",
	CmdFunc: func(settings *models.Settings) func(cmd *cli.Cmd) {
		return func(cmd *cli.Cmd) {
			cmd.Action = func() {
				if _, err := auth.New(settings, prompts.New()).Signin(); err != nil {
					logrus.Fatal(err.Error())
				}
				err := CmdWhoAmI(New(settings))
				if err != nil {
					logrus.Fatal(err.Error())
				}
			}
		}
	},
}

Cmd is the contract between the user and the CLI. This specifies the command name, arguments, and required/optional arguments and flags for the command.

Functions

func CmdWhoAmI

func CmdWhoAmI(w IWhoAmI) error

Types

type IWhoAmI

type IWhoAmI interface {
	WhoAmI() (string, error)
}

IWhoAmI

func New

func New(settings *models.Settings) IWhoAmI

New returns an instance of IWhoAmI

type SWhoAmI

type SWhoAmI struct {
	Settings *models.Settings
}

SWhoAmI is a concrete implementation of IWhoAmI

func (*SWhoAmI) WhoAmI

func (w *SWhoAmI) WhoAmI() (string, error)

WhoAmI returns your user ID.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL