update

package
v0.0.0-...-966d904 Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2018 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Cmd = models.Command{
	Name:      "update",
	ShortHelp: "Checks for available updates and updates the CLI if a new update is available",
	LongHelp: "<code>update</code> is a shortcut to update your CLI instantly. " +
		"If a newer version of the CLI is available, it will be downloaded and installed automatically. " +
		"This is used when you want to apply an update before the CLI automatically applies it on its own. " +
		"Here is a sample command\n\n" +
		"<pre>\ndatica update\n</pre>",
	CmdFunc: func(settings *models.Settings) func(cmd *cli.Cmd) {
		return func(cmd *cli.Cmd) {
			cmd.Action = func() {
				err := CmdUpdate(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 CmdUpdate

func CmdUpdate(iu IUpdate) error

Types

type IUpdate

type IUpdate interface {
	Check() (bool, error)
	Update() error
	UpdateEnvironments()
	UpdatePods()
}

IUpdate

func New

func New(settings *models.Settings) IUpdate

New returns an instance of IUpdate

type SUpdate

type SUpdate struct {
	Settings *models.Settings
}

SUpdate is a concrete implementation of IUpdate

func (*SUpdate) Check

func (u *SUpdate) Check() (bool, error)

func (*SUpdate) Update

func (u *SUpdate) Update() error

Update updates the CLI if a new update is available.

func (*SUpdate) UpdateEnvironments

func (u *SUpdate) UpdateEnvironments()

UpdateEnvironments retrieves all environments visible to the current user and stores them in the local cache.

func (*SUpdate) UpdatePods

func (u *SUpdate) UpdatePods()

UpdatePods retrieves the latest list of pods and refreshes the local cache. If an error occurs, the local cache is unchanged.

Jump to

Keyboard shortcuts

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