extension

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2024 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// ManifestFileName - Extension manifest file name
	ManifestFileName = "extension.json"
)

Variables

View Source
var (
	ErrExtensionDependModuleNotFound = errors.New("extension depends on module not found")
	DependOnMap                      = map[string]string{
		"coff-loader": consts.ModuleExecuteBof,
	}
)

Functions

func Commands

func Commands(con *repl.Console) []*cobra.Command

func ExecuteExtension added in v0.0.2

func ExecuteExtension(rpc clientrpc.MaliceRPCClient, sess *core.Session, extName string, args []string) (*clientpb.Task, error)

func ExtensionLoadCmd

func ExtensionLoadCmd(cmd *cobra.Command, con *repl.Console)

ExtensionLoadCmd - Load extension command

func ExtensionRegisterCommand

func ExtensionRegisterCommand(extCmd *ExtCommand, cmd *cobra.Command, con *repl.Console)

ExtensionRegisterCommand

func ExtensionsCmd

func ExtensionsCmd(cmd *cobra.Command, con *repl.Console)

ExtensionsCmd - List information about installed extensions

func ExtensionsCommandNameCompleter

func ExtensionsCommandNameCompleter(con *repl.Console) carapace.Action

ExtensionsCommandNameCompleter - Completer for installed extensions command names.

func ExtensionsInstallCmd

func ExtensionsInstallCmd(cmd *cobra.Command, con *repl.Console)

ExtensionsInstallCmd - Install an extension

func ExtensionsRemoveCmd

func ExtensionsRemoveCmd(cmd *cobra.Command, con *repl.Console)

ExtensionsRemoveCmd - Remove an extension

func InstallFromDir

func InstallFromDir(extLocalPath string, promptToOverwrite bool, con *repl.Console, isGz bool)

Install an extension from a directory

func PrintExtensions

func PrintExtensions(con *repl.Console)

PrintExtensions - Print a list of loaded extensions

func Register added in v0.0.2

func Register(con *repl.Console)

func RemoveExtensionByCommandName

func RemoveExtensionByCommandName(commandName string, con *repl.Console) error

RemoveExtensionByCommandName - Remove an extension by command name

Types

type ExtCommand

type ExtCommand struct {
	CommandName string               `json:"command_name"`
	Help        string               `json:"help"`
	LongHelp    string               `json:"long_help"`
	Files       []*extensionFile     `json:"files"`
	Arguments   []*extensionArgument `json:"arguments"`
	Entrypoint  string               `json:"entrypoint"`
	DependsOn   string               `json:"depends_on"`
	Init        string               `json:"init"`

	Manifest *ExtensionManifest
}

type ExtensionManifest

type ExtensionManifest struct {
	Name            string `json:"name"`
	Version         string `json:"version"`
	ExtensionAuthor string `json:"extension_author"`
	OriginalAuthor  string `json:"original_author"`
	RepoURL         string `json:"repo_url"`

	ExtCommand []*ExtCommand `json:"commands"`

	RootPath   string `json:"-"`
	ArmoryName string `json:"-"`
	ArmoryPK   string `json:"-"`
}

func LoadExtensionManifest

func LoadExtensionManifest(manifestPath string) (*ExtensionManifest, error)

LoadExtensionManifest - Parse extension files

func ParseExtensionManifest

func ParseExtensionManifest(data []byte) (*ExtensionManifest, error)

ParseExtensionManifest - Parse extension manifest from buffer

type ExtensionManifest_

type ExtensionManifest_ struct {
	Name            string               `json:"name"`
	CommandName     string               `json:"command_name"`
	Version         string               `json:"version"`
	ExtensionAuthor string               `json:"extension_author"`
	OriginalAuthor  string               `json:"original_author"`
	RepoURL         string               `json:"repo_url"`
	Help            string               `json:"help"`
	LongHelp        string               `json:"long_help"`
	Files           []*extensionFile     `json:"files"`
	Arguments       []*extensionArgument `json:"arguments"`
	Entrypoint      string               `json:"entrypoint"`
	DependsOn       string               `json:"depends_on"`
	Init            string               `json:"init"`

	RootPath string `json:"-"`
}

Jump to

Keyboard shortcuts

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