cmd

package
v0.0.0-...-0f323ce Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2018 License: MIT Imports: 41 Imported by: 0

Documentation

Index

Constants

View Source
const BashCmdName = "bash"

BashCmdName is the name identifier for the exec command

View Source
const BuildCmdName = "build"

BuildCmdName is the name identifier for the build command

View Source
const CheckConnectionCmdName = "checkconnection"

CheckConnectionCmdName is the command name identifier

View Source
const CheckUpdatesCmdName = "checkupdates"

CheckUpdatesCmdName is the command name identifier

View Source
const DeleteCmdName = "delete"

DeleteCmdName is the command name identifier

View Source
const DestroyCmdName = "destroy"

DestroyCmdName is the name identifier for the destroy command

View Source
const ExecCmdName = "exec"

ExecCmdName is the name identifier for the exec command

View Source
const FetchCmdName = "fetch"

FetchCmdName is the command name identifier

View Source
const ForwardCmdName = "forward"

ForwardCmdName is the command name identifier

View Source
const InitCmdName = "init"

InitCmdName is the name identifier for the build command

View Source
const LogsCmdName = "logs"

LogsCmdName is the command name identifier

View Source
const PushCmdName = "push"

PushCmdName is the command name identifier

View Source
const SyncCmdName = "sync"

SyncCmdName is the command name identifier

View Source
const WatchCmdName = "watch"

WatchCmdName is the command name identifier

Variables

View Source
var RootCmd = &cobra.Command{
	Use:   "cp-remote",
	Short: "A tool to help with using ContinuousPipe as a remote development environment.",
	Long: `A tool to help with using ContinuousPipe as a remote development environment.

This helps to set up Kubectl, create, build and destroy remote environments and keep files
in sync with the local filesystem.

You will need the following:

 * A ContinuousPipe hosted project with the GitHub integration set up
 * The project checked out locally
 * rsync and git installed locally

Note: if the GitHub repository is not the origin of your checked out project then you will
need to add a remote for that repository.`,
}

Functions

func Execute

func Execute()

func NewBashCmd

func NewBashCmd() *cobra.Command

func NewBuildCmd

func NewBuildCmd() *cobra.Command

NewBuildCmd return a new cobra command that handles the build

func NewCheckConnectionCmd

func NewCheckConnectionCmd() *cobra.Command

NewCheckConnectionCmd return a new cobra command that on run executes the CheckConnectionHandle

func NewCheckUpdatesCmd

func NewCheckUpdatesCmd() *cobra.Command

func NewDeleteCmd

func NewDeleteCmd() *cobra.Command

NewDeleteCmd returns a new command that wraps the kubectl delete command it finds the target pod and pass the arguments to the wrapped command

func NewDestroyCmd

func NewDestroyCmd() *cobra.Command

NewDestroyCmd return a new cobra command that handles the destruction of a remote environment

func NewExecCmd

func NewExecCmd() *cobra.Command

NewExecCmd return a cobra command struct pointer which on Run, if required it prepares the config so we can reach the pod and then uses a command handler to execute the command specified in the arguments

func NewFetchCmd

func NewFetchCmd() *cobra.Command

func NewForwardCmd

func NewForwardCmd() *cobra.Command

func NewInitCmd

func NewInitCmd() *cobra.Command

NewInitCmd Initialises the remote environment

func NewListPodsCmd

func NewListPodsCmd() *cobra.Command

NewListPodsCmd return a cobra cmd alias of NewCheckConnectionCmd

func NewLogsCmd

func NewLogsCmd() *cobra.Command

func NewPushCmd

func NewPushCmd() *cobra.Command

func NewSyncCmd

func NewSyncCmd() *cobra.Command

func NewVersionCmd

func NewVersionCmd() *cobra.Command

func NewWatchCmd

func NewWatchCmd() *cobra.Command

func RunExec

func RunExec(handler *execHandle, interactive bool, flowID string, args []string) (suggestion string, err error)

func RunPush

func RunPush(handler *PushHandle, args []string, settings *config.Config) (suggestion string, err error)

func RunWatch

func RunWatch(handler *WatchHandle, args []string, settings *config.Config) (reason string, err error)

Types

type BuildHandle

type BuildHandle struct {
	// contains filtered or unexported fields
}

BuildHandle holds the dependencies of the build handler

func (*BuildHandle) Handle

func (h *BuildHandle) Handle() (suggestion string, err error)

Handle performs the 2 init stages that trigger that build and wait for the environment to be ready

type CheckConnectionHandle

type CheckConnectionHandle struct {
	Command     *cobra.Command
	Environment string
	// contains filtered or unexported fields
}

CheckConnectionHandle holds the command handler dependencies

func (*CheckConnectionHandle) Complete

func (h *CheckConnectionHandle) Complete(cmd *cobra.Command, argsIn []string, setting *config.Config)

Complete verifies command line arguments and loads data from the command environment

func (*CheckConnectionHandle) Handle

func (h *CheckConnectionHandle) Handle(args []string, podsFinder pods.Finder) (suggestion string, err error)

Handle finds the pods and prints them

func (*CheckConnectionHandle) Validate

func (h *CheckConnectionHandle) Validate() error

Validate checks that the provided checkconnection options are specified.

type CheckUpdates

type CheckUpdates struct {
	Command *cobra.Command
}

func (*CheckUpdates) Handle

func (h *CheckUpdates) Handle(args []string) (suggestion string, err error)

type DeletePodCmdHandle

type DeletePodCmdHandle struct {
	// contains filtered or unexported fields
}

DeletePodCmdHandle holds the information required to delete a pod

func (*DeletePodCmdHandle) Complete

func (h *DeletePodCmdHandle) Complete(argsIn []string, settings *config.Config)

Complete verifies command line arguments and loads data from the command environment

func (*DeletePodCmdHandle) Handle

func (h *DeletePodCmdHandle) Handle(args []string) (suggestion string, err error)

Handle set the flags in the kubeclt logs handle command and executes it

func (*DeletePodCmdHandle) Validate

func (h *DeletePodCmdHandle) Validate() error

Validate checks that the provided exec options are specified.

type DestroyHandle

type DestroyHandle struct {
	// contains filtered or unexported fields
}

DestroyHandle holds the dependencies of the destroy handler

func NewDestroyHandle

func NewDestroyHandle() *DestroyHandle

NewDestroyHandle ctor for the DestroyHandle struct

func (*DestroyHandle) Handle

func (h *DestroyHandle) Handle() (suggestion string, err error)

Handle cancels a running tide if exists, then deletes the remote environment via CP Api and finally proceed with the deletion of the git remote branch

type FetchHandle

type FetchHandle struct {
	Command           *cobra.Command
	Environment       string
	Service           string
	File              string
	RemoteProjectPath string
	// contains filtered or unexported fields
}

func (*FetchHandle) Complete

func (h *FetchHandle) Complete(cmd *cobra.Command, argsIn []string, settings *config.Config)

Complete verifies command line arguments and loads data from the command environment

func (*FetchHandle) Handle

func (h *FetchHandle) Handle(args []string, podsFinder pods.Finder, podsFilter pods.Filter, fetcher sync.Fetcher) (suggestion string, err error)

Copies all the files and folders from the remote development environment into the current directory

func (*FetchHandle) Validate

func (h *FetchHandle) Validate() error

Validate checks that the provided fetch options are specified.

type ForwardHandle

type ForwardHandle struct {
	Command *cobra.Command

	Environment string
	Service     string
	// contains filtered or unexported fields
}

func (*ForwardHandle) Complete

func (h *ForwardHandle) Complete(cmd *cobra.Command, argsIn []string, settings *config.Config)

Complete verifies command line arguments and loads data from the command environment

func (*ForwardHandle) Handle

func (h *ForwardHandle) Handle() (suggestion string, err error)

func (*ForwardHandle) Validate

func (h *ForwardHandle) Validate() error

Validate checks that the provided forward options are specified.

type Handler

type Handler interface {
	Handle(cmd *cobra.Command, args []string)
}

type InitHandler

type InitHandler struct {
	// contains filtered or unexported fields
}

InitHandler is the default initialisation mode which prepare the remote environment so that can be used with any command.

func NewInitHandler

func NewInitHandler(remoteName string, reset bool) *InitHandler

NewInitHandler ctor for InitHandler

func (*InitHandler) Complete

func (i *InitHandler) Complete(argsIn []string) (suggestion string, err error)

Complete verifies command line arguments and loads data from the command environment

func (InitHandler) Handle

func (i InitHandler) Handle() (suggestion string, err error)

Handle Executes the initialization

func (*InitHandler) SetWriter

func (i *InitHandler) SetWriter(writer io.Writer)

SetWriter sets the default writer for the struct

func (InitHandler) Validate

func (i InitHandler) Validate() error

Validate checks that the token provided has at least 5 values comma separated

type InitInteractiveHandler

type InitInteractiveHandler struct {
	// contains filtered or unexported fields
}

InitInteractiveHandler is a interactive mode strategy where we request the user to insert the global configuration data which is the cp username and cp api-key which are mandatory to use the interactive mode on all command that support it.

func NewInitInteractiveHandler

func NewInitInteractiveHandler(reset bool) *InitInteractiveHandler

NewInitInteractiveHandler ctor for InitInteractiveHandler

func (*InitInteractiveHandler) Complete

func (i *InitInteractiveHandler) Complete(argsIn []string) (suggestion string, err error)

Complete verifies command line arguments and loads data from the command environment

func (InitInteractiveHandler) Handle

func (i InitInteractiveHandler) Handle() (suggestion string, err error)

Handle request the user the config data required for the interactive mode to work

func (*InitInteractiveHandler) SetWriter

func (i *InitInteractiveHandler) SetWriter(writer io.Writer)

SetWriter sets the default writer for the struct

func (InitInteractiveHandler) Validate

func (i InitInteractiveHandler) Validate() error

Validate checks that the handler has all it needs

type InitStrategy

type InitStrategy interface {
	Complete(argsIn []string) (suggestion string, err error)
	Validate() error
	Handle() (suggestion string, err error)
	SetWriter(io.Writer)
}

InitStrategy is the interface for the init strategy struct

type LogsCmdHandle

type LogsCmdHandle struct {
	// contains filtered or unexported fields
}

func (*LogsCmdHandle) Complete

func (h *LogsCmdHandle) Complete(cmd *cobra.Command, argsIn []string, settings *config.Config)

Complete verifies command line arguments and loads data from the command environment

func (*LogsCmdHandle) Handle

func (h *LogsCmdHandle) Handle(args []string, podsFinder pods.Finder, podsFilter pods.Filter) (suggestion string, err error)

Handle set the flags in the kubeclt logs handle command and executes it

func (*LogsCmdHandle) Validate

func (h *LogsCmdHandle) Validate() error

Validate checks that the provided exec options are specified.

type PushHandle

type PushHandle struct {
	// contains filtered or unexported fields
}

func (*PushHandle) Complete

func (h *PushHandle) Complete(argsIn []string, settings *config.Config)

Complete verifies command line arguments and loads data from the command environment

func (*PushHandle) Handle

func (h *PushHandle) Handle(args []string, podsFinder pods.Finder, podsFilter pods.Filter, syncer sync.Syncer) (suggestion string, err error)

Copies all the files and folders from the current directory into the remote container

func (*PushHandle) Validate

func (h *PushHandle) Validate() error

Validate checks that the provided push options are specified.

type VersionHandle

type VersionHandle struct {
	Command *cobra.Command
}

func (*VersionHandle) Handle

func (h *VersionHandle) Handle(args []string)

type WatchHandle

type WatchHandle struct {
	Stdout io.Writer
	// contains filtered or unexported fields
}

func (*WatchHandle) Complete

func (h *WatchHandle) Complete(argsIn []string, settings *config.Config)

Complete verifies command line arguments and loads data from the command environment

func (*WatchHandle) Handle

func (h *WatchHandle) Handle(dirMonitor monitor.DirectoryMonitor, podsFinder pods.Finder, podsFilter pods.Filter) (suggestion string, err error)

func (*WatchHandle) Validate

func (h *WatchHandle) Validate() (suggestion string, err error)

Validate checks that the provided watch options are specified.

Jump to

Keyboard shortcuts

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