app

package
v0.0.9 Latest Latest
Warning

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

Go to latest
Published: Jan 16, 2023 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Api

type Api struct {
	Extensions    []Extension
	ExtensionRoot string
}

func (*Api) IsExtensionInstalled added in v0.0.9

func (api *Api) IsExtensionInstalled(name string) bool

func (*Api) LoadExtensions added in v0.0.9

func (api *Api) LoadExtensions(extensionRoot string) error

type Command added in v0.0.9

type Command struct {
	Name        string
	Exec        string        `json:"exec" yaml:"exec"`
	Description string        `json:"description" yaml:"description"`
	Preferences []ScriptInput `json:"preferences" yaml:"preferences"`
	Inputs      []ScriptInput `json:"inputs" yaml:"inputs"`
	Page        Page          `json:"page" yaml:"page"`

	OnSuccess string `json:"onSuccess" yaml:"onSuccess"`
}

func (Command) Cmd added in v0.0.9

func (s Command) Cmd(with map[string]any) (string, error)

type Detail

type Detail struct {
	Actions []ScriptAction `json:"actions"`
	DetailData
}

type DetailData

type DetailData struct {
	Preview   string           `json:"preview"`
	Metadatas []ScriptMetadata `json:"metadatas"`
}

type Extension

type Extension struct {
	Title       string        `json:"title" yaml:"title"`
	Description string        `json:"description" yaml:"description"`
	Name        string        `json:"name" yaml:"name"`
	PostInstall string        `json:"postInstall" yaml:"postInstall"`
	Root        string        `json:"root" yaml:"root"`
	Preferences []ScriptInput `json:"preferences" yaml:"preferences"`

	Requirements []ExtensionRequirement `json:"requirements" yaml:"requirements"`
	RootItems    []RootItem             `json:"rootItems" yaml:"rootItems"`
	Commands     map[string]Command     `json:"commands" yaml:"commands"`
}

func ParseManifest

func ParseManifest(extensionName string, manifestPath string) (extension Extension, err error)

type ExtensionRequirement

type ExtensionRequirement struct {
	Which    string `json:"which" yaml:"which"`
	HomePage string `json:"homePage" yaml:"homePage"`
}

func (ExtensionRequirement) Check

func (r ExtensionRequirement) Check() bool

type Optional added in v0.0.9

type Optional[T any] struct {
	Defined bool
	Value   T
}

func (*Optional[T]) UnmarshalJSON added in v0.0.9

func (o *Optional[T]) UnmarshalJSON(data []byte) error

UnmarshalJSON is implemented by deferring to the wrapped type (T). It will be called only if the value is defined in the JSON payload.

func (*Optional[T]) UnmarshalYAML added in v0.0.9

func (o *Optional[T]) UnmarshalYAML(value *yaml.Node) (err error)

type Page added in v0.0.9

type Page struct {
	Type        string `json:"type"`
	ShowPreview bool   `json:"showPreview" yaml:"showPreview"`
	IsGenerator bool   `json:"isGenerator" yaml:"isGenerator"`
}

type RootItem

type RootItem struct {
	Extension string
	Script    string
	Title     string
	Subtitle  string
	With      map[string]any
}

type ScriptAction

type ScriptAction struct {
	Title    string `json:"title"`
	Type     string `json:"type"`
	Shortcut string `json:"shortcut"`

	Text string `json:"text"`

	Url  string `json:"url"`
	Path string `json:"path"`

	Extension string `json:"extension"`
	Script    string `json:"script"`
	Command   string `json:"command"`
	Dir       string

	OnSuccess string                          `json:"onSuccess"`
	With      map[string]ScriptInputWithValue `json:"with"`
}

type ScriptInput

type ScriptInput struct {
	Name        string           `json:"name" yaml:"name"`
	Type        string           `json:"type"`
	Title       string           `json:"title"`
	Placeholder Optional[string] `json:"placeholder"`
	Default     Optional[any]    `json:"defaultValue" yaml:"defaultValue"`

	Data []struct {
		Title string `json:"title,omitempty"`
		Value string `json:"value,omitempty"`
	} `json:"data,omitempty"`
	Label string `json:"label"`
}

type ScriptInputWithValue added in v0.0.9

type ScriptInputWithValue struct {
	Value any
	ScriptInput
}

func (ScriptInputWithValue) GetValue added in v0.0.9

func (si ScriptInputWithValue) GetValue() (any, error)

func (*ScriptInputWithValue) UnmarshalJSON added in v0.0.9

func (si *ScriptInputWithValue) UnmarshalJSON(bytes []byte) (err error)

func (*ScriptInputWithValue) UnmarshalYAML added in v0.0.9

func (si *ScriptInputWithValue) UnmarshalYAML(value *yaml.Node) (err error)

type ScriptItem

type ScriptItem struct {
	Id       string `json:"id"`
	Title    string `json:"title"`
	Subtitle string `json:"subtitle"`
	DetailData
	Accessories []string       `json:"accessories"`
	Actions     []ScriptAction `json:"actions"`
}

func ParseListItems

func ParseListItems(output string) (items []ScriptItem, err error)

func (ScriptItem) PreviewCommand

func (li ScriptItem) PreviewCommand() *exec.Cmd

type ScriptMetadata

type ScriptMetadata struct {
	Title string `json:"title"`
	Value string `json:"value"`
}

Jump to

Keyboard shortcuts

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