executor

package
v0.0.0-...-5b94c7c Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2022 License: MIT Imports: 16 Imported by: 0

Documentation

Overview

Package executor is a generated GoMock package.

Index

Constants

This section is empty.

Variables

View Source
var Factories = []Factory{
	{
		Cmd:         "help",
		Description: "display help",
		Create: func(_ conf.Conf, tr trello.Repository, r renderer.Renderer, session *trello.Session, stdout, stderr io.Writer) Executor {
			return &help{
				stdout: stdout,
			}
		},
	},
	{
		Cmd:         "exit",
		Description: "exit CLI",
		Create: func(_ conf.Conf, tr trello.Repository, r renderer.Renderer, session *trello.Session, stdout, stderr io.Writer) Executor {
			return &exit{}
		},
	},
	{
		Cmd:         "clear",
		Description: "clear the terminal screen & cache",
		Create: func(_ conf.Conf, tr trello.Repository, r renderer.Renderer, session *trello.Session, stdout, stderr io.Writer) Executor {
			return &clear{
				executor{
					tr:      tr,
					r:       r,
					session: session,
					stdout:  stdout,
					stderr:  stderr,
				},
			}
		},
	},
	{
		Cmd:         "cd",
		Description: "change level in the hierarchy",
		Create: func(_ conf.Conf, tr trello.Repository, r renderer.Renderer, session *trello.Session, stdout, stderr io.Writer) Executor {
			return &cd{executor{
				tr:      tr,
				r:       r,
				session: session,
				stdout:  stdout,
				stderr:  stderr,
			}}
		},
	},
	{
		Cmd:         "ls",
		Description: "list resource content",
		Create: func(_ conf.Conf, tr trello.Repository, r renderer.Renderer, session *trello.Session, stdout, stderr io.Writer) Executor {
			return &ls{executor{
				tr:      tr,
				r:       r,
				session: session,
				stdout:  stdout,
				stderr:  stderr,
			}}
		},
	},
	{
		Cmd:         "cat",
		Description: "show resource content info",
		Create: func(_ conf.Conf, tr trello.Repository, r renderer.Renderer, session *trello.Session, stdout, stderr io.Writer) Executor {
			return &cat{executor{
				tr:      tr,
				r:       r,
				session: session,
				stdout:  stdout,
				stderr:  stderr,
			}}
		},
	},
	{
		Cmd:         "edit",
		Description: "edit resource content",
		Create: func(conf conf.Conf, tr trello.Repository, r renderer.Renderer, session *trello.Session, stdout, stderr io.Writer) Executor {
			return &edit{
				executor: executor{
					tr:      tr,
					r:       r,
					session: session,
					stdout:  stdout,
					stderr:  stderr,
				},
				stdin:         os.Stdin,
				editor:        NewOsEditor(conf.Editor),
				editRenderer:  renderer.NewEdit(conf.Format),
				defaultLabels: conf.Labels,
				neverPrompt:   conf.NeverPrompt,
			}
		},
	},
	{
		Cmd:         "touch",
		Description: "create new resource",
		Create: func(conf conf.Conf, tr trello.Repository, r renderer.Renderer, session *trello.Session, stdout, stderr io.Writer) Executor {
			return &touch{
				executor: executor{
					tr:      tr,
					r:       r,
					session: session,
					stdout:  stdout,
					stderr:  stderr,
				},
			}
		},
	},
	{
		Cmd:         "rm",
		Description: "archive resource",
		Create: func(conf conf.Conf, tr trello.Repository, r renderer.Renderer, session *trello.Session, stdout, stderr io.Writer) Executor {
			return &rm{
				executor: executor{
					tr:      tr,
					r:       r,
					session: session,
					stdout:  stdout,
					stderr:  stderr,
				},
				stdin:       os.Stdin,
				neverPrompt: conf.NeverPrompt,
			}
		},
	},
	{
		Cmd:         "mv",
		Description: "move resource",
		Create: func(conf conf.Conf, tr trello.Repository, r renderer.Renderer, session *trello.Session, stdout, stderr io.Writer) Executor {
			return &mv{
				executor: executor{
					tr:      tr,
					r:       r,
					session: session,
					stdout:  stdout,
					stderr:  stderr,
				},
			}
		},
	},
	{
		Cmd:         "cp",
		Description: "copy resource",
		Create: func(conf conf.Conf, tr trello.Repository, r renderer.Renderer, session *trello.Session, stdout, stderr io.Writer) Executor {
			return &cp{
				executor: executor{
					tr:      tr,
					r:       r,
					session: session,
					stdout:  stdout,
					stderr:  stderr,
				},
			}
		},
	},
}

Functions

This section is empty.

Types

type Editor

type Editor interface {
	Edit(in []byte, fileType string) (out []byte, err error)
}

func NewOsEditor

func NewOsEditor(editorCommand string) Editor

type Executor

type Executor interface {
	Execute(args []string)
}

func New

func New(conf conf.Conf, cmd string, tr trello.Repository, r renderer.Renderer, session *trello.Session, stdout, stderr io.Writer) Executor

func NewOS

func NewOS(stdin io.Reader, stdout, stderr io.Writer) Executor

type Factory

type Factory struct {
	Cmd         string
	Description string
	Create      func(conf conf.Conf, tr trello.Repository, r renderer.Renderer, session *trello.Session, stdout, stderr io.Writer) Executor
}

type MockEditor

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

MockEditor is a mock of Editor interface.

func NewMockEditor

func NewMockEditor(ctrl *gomock.Controller) *MockEditor

NewMockEditor creates a new mock instance.

func (*MockEditor) EXPECT

func (m *MockEditor) EXPECT() *MockEditorMockRecorder

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockEditor) Edit

func (m *MockEditor) Edit(in []byte, fileType string) ([]byte, error)

Edit mocks base method.

type MockEditorMockRecorder

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

MockEditorMockRecorder is the mock recorder for MockEditor.

func (*MockEditorMockRecorder) Edit

func (mr *MockEditorMockRecorder) Edit(in, fileType interface{}) *gomock.Call

Edit indicates an expected call of Edit.

type OS

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

func (OS) Execute

func (o OS) Execute(args []string)

type OsEditor

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

func (OsEditor) Edit

func (o OsEditor) Edit(in []byte, fileType string) (out []byte, err error)

Jump to

Keyboard shortcuts

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