types

package
v0.9.15 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CopyAction   = "copy"
	OpenAction   = "open"
	PushAction   = "push"
	RunAction    = "run"
	ExitAction   = "exit"
	ReloadAction = "reload"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Action

type Action struct {
	Title  string     `json:"title,omitempty"`
	Type   ActionType `json:"type"`
	Key    string     `json:"key,omitempty"`
	Inputs []Input    `json:"inputs,omitempty"`

	// copy
	Text string `json:"text,omitempty"`

	// open
	Target string `json:"target,omitempty"`

	// push
	Page string `json:"page,omitempty"`

	// run
	Command         *Command `json:"command,omitempty"`
	ReloadOnSuccess bool     `json:"reloadOnSuccess,omitempty"`
}

func NewCopyAction added in v0.9.13

func NewCopyAction(title string, text string) Action

func NewOpenAction added in v0.9.13

func NewOpenAction(title string, target string) Action

func NewPushAction added in v0.9.13

func NewPushAction(title string, page string) Action

func NewRunAction added in v0.9.13

func NewRunAction(title string, name string, args ...string) Action

type ActionType

type ActionType string

type Command added in v0.9.0

type Command struct {
	Name  string   `json:"name"`
	Args  []string `json:"args,omitempty"`
	Input string   `json:"input,omitempty"`
	Dir   string   `json:"dir,omitempty"`
}

func (Command) Cmd added in v0.9.0

func (c Command) Cmd() *exec.Cmd

func (Command) Output added in v0.9.0

func (c Command) Output() ([]byte, error)

func (Command) Run added in v0.9.0

func (c Command) Run() error

func (*Command) UnmarshalJSON added in v0.9.0

func (c *Command) UnmarshalJSON(data []byte) error
type DropDownItem struct {
	Title string `json:"title"`
	Value string `json:"value"`
}

type FormInputType

type FormInputType string
const (
	TextFieldInput FormInputType = "textfield"
	TextAreaInput  FormInputType = "textarea"
	DropDownInput  FormInputType = "dropdown"
	CheckboxInput  FormInputType = "checkbox"
)

type Input added in v0.7.0

type Input struct {
	Name        string        `json:"name"`
	Type        FormInputType `json:"type"`
	Title       string        `json:"title"`
	Placeholder string        `json:"placeholder,omitempty"`
	Default     any           `json:"default,omitempty"`

	// Only for dropdown
	Items []DropDownItem `json:"items,omitempty"`

	// Only for checkbox
	Label             string `json:"label,omitempty"`
	TrueSubstitution  string `json:"trueSubstitution,omitempty"`
	FalseSubstitution string `json:"falseSubstitution,omitempty"`
}

type ListItem

type ListItem struct {
	Id          string   `json:"id,omitempty"`
	Title       string   `json:"title"`
	Subtitle    string   `json:"subtitle,omitempty"`
	Preview     *Preview `json:"preview,omitempty"`
	Accessories []string `json:"accessories,omitempty"`
	Actions     []Action `json:"actions,omitempty"`
}

type Page

type Page struct {
	Type    PageType `json:"type"`
	Title   string   `json:"title,omitempty"`
	Actions []Action `json:"actions,omitempty"`

	// Detail page
	Preview *Preview `json:"preview,omitempty"`

	// List page
	ShowPreview bool `json:"showPreview,omitempty"`
	EmptyView   *struct {
		Text    string   `json:"text,omitempty"`
		Actions []Action `json:"actions,omitempty"`
	} `json:"emptyView,omitempty"`
	Items []ListItem `json:"items,omitempty"`
}

type PageType

type PageType string
const (
	DetailPage PageType = "detail"
	ListPage   PageType = "list"
)

type Preview added in v0.9.0

type Preview struct {
	HighLight string   `json:"highlight,omitempty"`
	Text      string   `json:"text,omitempty"`
	Command   *Command `json:"command,omitempty"`
}

Jump to

Keyboard shortcuts

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