clear

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: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Cmd = models.Command{
	Name:      "clear",
	ShortHelp: "Clear out information in the global settings file to fix a misconfigured CLI.",
	LongHelp: "<code>clear</code> allows you to manage your global settings file in case your CLI becomes misconfigured. " +
		"The global settings file is stored in your home directory at <code>~/.datica</code>. " +
		"You can clear out all settings or pick and choose which ones need to be removed. " +
		"After running the <code>clear</code> command, any other CLI command will reset the removed settings to their appropriate values. Here are some sample commands\n\n" +
		"<pre>\ndatica clear --all\n" +
		"datica clear --environments # removes your locally cached environment(s) configuration data\n" +
		"datica clear --session --private-key # removes all session and private key authentication information\n</pre>",
	CmdFunc: func(settings *models.Settings) func(cmd *cli.Cmd) {
		return func(cmd *cli.Cmd) {
			privateKey := cmd.BoolOpt("private-key", false, "Clear out the saved private key information")
			session := cmd.BoolOpt("session", false, "Clear out all session information")
			envs := cmd.BoolOpt("environments", false, "Clear out all your environment data")
			pods := cmd.BoolOpt("pods", false, "Clear out all saved pods")
			all := cmd.BoolOpt("all", false, "Clear out all settings")
			cmd.Action = func() {
				if *all {
					*privateKey = true
					*session = true
					*envs = true
					*pods = true
				}
				err := CmdClear(*privateKey, *session, *envs, *pods, settings)
				if err != nil {
					logrus.Fatal(err.Error())
				}
			}
			cmd.Spec = "[--private-key] [--session] [--environments] [--pods] [--all]"
		}
	},
}

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 CmdClear

func CmdClear(privateKey, session, environments, pods bool, settings *models.Settings) error

Types

This section is empty.

Jump to

Keyboard shortcuts

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