types

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

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

Variables

View Source
var TypeScript string

Functions

This section is empty.

Types

type Action

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

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

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

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

	// run
	Command   *Command      `json:"command,omitempty" yaml:"command,omitempty"`
	OnSuccess OnSuccessType `json:"onSuccess,omitempty" yaml:"onSuccess,omitempty"`
}

type ActionType

type ActionType string

type Command added in v0.9.0

type Command struct {
	Args  []string `json:"args" yaml:"args"`
	Input string   `json:"input,omitempty" yaml:"input,omitempty"`
	Dir   string   `json:"dir,omitempty" yaml:"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

func (*Command) UnmarshalYAML added in v0.9.0

func (c *Command) UnmarshalYAML(unmarshal func(interface{}) error) error
type DropDownItem struct {
	Title string `json:"title" yaml:"title"`
	Value string `json:"value" yaml:"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" yaml:"name"`
	Type        FormInputType `json:"type" yaml:"type"`
	Title       string        `json:"title" yaml:"title"`
	Placeholder string        `json:"placeholder,omitempty" yaml:"placeholder,omitempty"`
	Default     any           `json:"default,omitempty" yaml:"default,omitempty"`

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

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

type ListItem

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

type OnSuccessType

type OnSuccessType string
var (
	OpenOnSuccess   OnSuccessType = "open"
	PushOnSuccess   OnSuccessType = "push"
	ExitOnSuccess   OnSuccessType = "exit"
	ReloadOnSuccess OnSuccessType = "reload"
	CopyOnSuccess   OnSuccessType = "copy"
)

type Page

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

	// Form page
	SubmitAction *Action `json:"submitAction,omitempty" yaml:"submitAction,omitempty"`

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

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

type PageType

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

type Preview added in v0.9.0

type Preview struct {
	Type     PreviewType `json:"type,omitempty" yaml:"type,omitempty"`
	Language string      `json:"language,omitempty" yaml:"language,omitempty"`
	Text     string      `json:"text,omitempty" yaml:"text,omitempty"`
	Command  *Command    `json:"command,omitempty" yaml:"command,omitempty"`
}

type PreviewType added in v0.9.0

type PreviewType string
const (
	StaticPreviewType PreviewType = "static"
	DynamicPageType   PreviewType = "dynamic"
)

Jump to

Keyboard shortcuts

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