Documentation

Overview

Package caplets contains functions to enumerate, load and execute caplets.

Index

Constants

View Source
const (
	EnvVarName     = "CAPSPATH"
	Suffix         = ".cap"
	InstallArchive = "https://github.com/bettercap/caplets/archive/master.zip"
)

Variables

View Source
var (
	InstallBase        = getInstallBase()
	InstallPathArchive = filepath.Join(InstallBase, "caplets-master")
	InstallPath        = filepath.Join(InstallBase, "caplets")
	ArchivePath        = filepath.Join(os.TempDir(), "caplets.zip")

	LoadPaths = []string{
		"./",
		"./caplets/",
		InstallPath,
		filepath.Join(getUserHomeDir(), "caplets"),
	}
)

Functions

This section is empty.

Types

type Caplet

type Caplet struct {
	Script
	Name    string   `json:"name"`
	Scripts []Script `json:"scripts"`
}

func List

func List() []*Caplet

func Load

func Load(name string) (error, *Caplet)

func NewCaplet

func NewCaplet(name string, path string, size int64) Caplet

func (*Caplet) Eval

func (cap *Caplet) Eval(argv []string, lineCb func(line string) error) error

type Script

type Script struct {
	Path string   `json:"path"`
	Size int64    `json:"size"`
	Code []string `json:"code"`
}