cli

package
v3.0.2+incompatible Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2018 License: MIT Imports: 20 Imported by: 2

Documentation

Index

Constants

View Source
const (
	// FlagConfigFile -- context config data key
	FlagConfigFile = "config"
	// FlagAPIaddr -- API address context key
	FlagAPIaddr = "apiaddr"
)
View Source
const (
	// ErrFatalError -- unrecoverable fatal error
	ErrFatalError chkitErrors.Err = "fatal error"
)
View Source
const (
	ErrUnableToReadLogs chkitErrors.Err = "unable to read logs"
)

Variables

View Source
var Create = &cobra.Command{
	Use:   "create",
	Short: "Create deployment or service",
	PersistentPreRun: func(command *cobra.Command, args []string) {
		prerun.PreRun()
	},
	Run: func(cmd *cobra.Command, args []string) {
		cmd.Help()
	},
	PersistentPostRun: func(command *cobra.Command, args []string) {
		if context.GlobalContext.Changed {
			if err := configuration.SaveConfig(); err != nil {
				logrus.WithError(err).Errorf("unable to save config")
				fmt.Printf("Unable to save config: %v\n", err)
				return
			}
		}
		if err := configuration.SaveTokens(context.GlobalContext.Client.Tokens); err != nil {
			logrus.WithError(err).Errorf("unable to save tokens")
			fmt.Printf("Unable to save tokens: %v\n", err)
			return
		}
	},
}
View Source
var Delete = &cobra.Command{
	Use:   "delete",
	Short: "Delete resource",
	PersistentPreRun: func(command *cobra.Command, args []string) {
		prerun.PreRun()
	},
	Run: func(command *cobra.Command, args []string) {
		command.Help()
	},
	PersistentPostRun: func(command *cobra.Command, args []string) {
		if context.GlobalContext.Changed {
			if err := configuration.SaveConfig(); err != nil {
				logrus.WithError(err).Errorf("unable to save config")
				fmt.Printf("Unable to save config: %v\n", err)
				return
			}
		}
		if err := configuration.SaveTokens(context.GlobalContext.Client.Tokens); err != nil {
			logrus.WithError(err).Errorf("unable to save tokens")
			fmt.Printf("Unable to save tokens: %v\n", err)
			return
		}
	},
}
View Source
var Get = &cobra.Command{
	Use:   "get",
	Short: "Delete resource data",
	PersistentPreRun: func(command *cobra.Command, args []string) {
		prerun.PreRun()
	},
	Run: func(command *cobra.Command, args []string) {
		command.Help()
	},
	PersistentPostRun: func(command *cobra.Command, args []string) {
		if context.GlobalContext.Changed {
			if err := configuration.SaveConfig(); err != nil {
				logrus.WithError(err).Errorf("unable to save config")
				fmt.Printf("Unable to save config: %v\n", err)
				return
			}
		}
		if err := configuration.SaveTokens(context.GlobalContext.Client.Tokens); err != nil {
			logrus.WithError(err).Errorf("unable to save tokens")
			fmt.Printf("Unable to save tokens: %v\n", err)
			return
		}
	},
}
View Source
var Root = &cobra.Command{
	Use:     "chkit",
	Short:   "Chkit is a containerum.io terminal client",
	Version: Version,
	PreRun: func(*cobra.Command, []string) {
		prerun.PreRun()
	},
	Run: func(cmd *cobra.Command, args []string) {
		fmt.Printf("Hello, %q!\nUsing %q as default namespace\n",
			context.GlobalContext.Client.Username,
			context.GlobalContext.Namespace)
		if err := mainActivity(); err != nil {
			logrus.Fatalf("error in main activity: %v", err)
		}
	},
	PostRun: func(cmd *cobra.Command, args []string) {
		if !context.GlobalContext.Changed {
			return
		}
		if err := configuration.SaveConfig(); err != nil {
			fmt.Printf("Unable to save config file: %v\n", err)
		}
	},
}
View Source
var (
	// Version -- chkit version
	Version = "3.0.0-alpha"
)

Functions

func Logs

func Logs(ctx *context.Context) *cobra.Command

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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