common

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2023 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DirHandler

type DirHandler func(dir string) error

type Displayer

type Displayer interface {
	SetVerbose(bool)

	WroteDirectoriesInFile(wrote []string, file string, dir string)
}

Displayer should not return errors, it should always display something and execution should not depend on display succeeding

type GoMod

type GoMod interface {
	Open(dir string) (GoModFile, error)
}

type GoModFile

type GoModFile interface {
	File() *modfile.File
	DropReplace(packageName, packageVersion string) error
}

type GoWork

type GoWork interface {
	Read() (*modfile.WorkFile, error)
	Write(file *modfile.WorkFile) error
	Edit(func(*modfile.WorkFile) error) error

	Remove()
	Clean() error
	Init() error

	AddUse(dir string) error
	RemoveUse(dir string) error

	RelativeTo(dir string) (string, error)
}

type ReturnToDirMethod

type ReturnToDirMethod func() error

Sent with a method that changes current directory, call to return to the previous directory, equivalent to `cd -`

type RunWith

type RunWith interface {
	/* Runs the command with dir being the absolute path for every folder defined in a workspace */
	Absolute() error

	/* Runs the command with dir being the relative path for every folder defined in a workspace */
	Relative() error

	/* Runs the command with dir being the absolute path for every folder defined in the workspace's directory */
	Root() error
}

type Runtime

type Runtime interface {
	Execute(name string, args ...string) error
	DisplayExec(name string, args ...string)
	ExecuteInDir(dir, name string, args ...string) error
	ExecuteCapture(name string, args ...string) (out, errOut string, err error)
	ExecuteCaptureInDir(dir, name string, args ...string) (out, errOut string, err error)
	WriteFile(name string, data []byte, perm fs.FileMode) error
	RemoveAll(path string) error
	Remove(path string) error
	Chdir(dir string) (r ReturnToDirMethod, err error)
	RemoveIfExist(fileName string) (removed bool)

	// Exported CLI commands
	Bool(string) bool

	Dry() bool

	SetContext(ctx *cli.Context)
}

type VsFolder

type VsFolder struct {
	Path string `json:"path"`
}

type VsWorkspace

type VsWorkspace struct {
	Folders  []VsFolder             `json:"folders"`
	Settings map[string]interface{} `json:"settings"`
}
{
	"folders": [
			{
					"path": "dreamland-cli"
			}
	],
	"settings": {}
}

func (VsWorkspace) List

func (ws VsWorkspace) List() []string

type WorkSpaceHandler

type WorkSpaceHandler func(vs *VsWorkspace) error

type Workspace

type Workspace interface {
	Stat() error
	Delete() error

	/* Defines a runWith for running commands asynchronously */
	ForEach(DirHandler) RunWith
	Loc() string
	Dir() string
	FileName() string

	Read() (VsWorkspace, error)
	Write(vs VsWorkspace) error
	Edit(WorkSpaceHandler) error

	New() error
	OpenWithCode() error

	AddUse(dir string) error
	RemoveUse(dir string) error

	List() ([]string, error)
	RelativeTo(dir string) (string, error)
}

Jump to

Keyboard shortcuts

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