template

package
v1.14.0 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2024 License: MIT Imports: 4 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CommandMatchers

type CommandMatchers struct {
	Prefix string `yaml:"prefix"`
	Regexp string `yaml:"regex"`
}

CommandMatchers represents different command matching strategies.

type Paginate

type Paginate struct {
	Page        int `yaml:"page"`
	CurrentPage int `yaml:"-"`
}

Paginate holds data required to do the pagination.

type ParseMessage

type ParseMessage struct {
	Selects []Select          `yaml:"selects"`
	Actions map[string]string `yaml:"actions"`
	Preview string            `yaml:"preview"`
}

ParseMessage holds template for message that will be parsed by defined parser.

type Select

type Select struct {
	Name   string `yaml:"name"`
	KeyTpl string `yaml:"keyTpl"`
}

Select holds template select primitive definition.

type Template

type Template struct {
	Type                 string          `yaml:"type"`
	Trigger              Trigger         `yaml:"trigger"`
	SkipCommandExecution bool            `yaml:"-"`
	ParseMessage         ParseMessage    `yaml:"-"`
	WrapMessage          WrapMessage     `yaml:"-"`
	TutorialMessage      TutorialMessage `yaml:"-"`
}

Template represents a template for message parsing.

func FindTemplate

func FindTemplate(tpls []Template, cmd string) (Template, bool)

FindTemplate finds a template with a matching command prefix.

func (*Template) UnmarshalYAML

func (su *Template) UnmarshalYAML(node *yaml.Node) error

UnmarshalYAML is a custom unmarshaler for Template allowing to unmarshal into a proper struct base on defined template type.

type Trigger

type Trigger struct {
	Command CommandMatchers `yaml:"command"`
}

Trigger represents the trigger configuration for a template.

type TutorialMessage

type TutorialMessage struct {
	Buttons  api.Buttons `yaml:"buttons"`
	Header   string      `yaml:"header"`
	Paginate Paginate    `yaml:"paginate"`
}

TutorialMessage holds template interactive tutorial message.

type WrapMessage

type WrapMessage struct {
	Buttons api.Buttons `yaml:"buttons"`
}

WrapMessage holds template for wrapping command output with additional context.

Jump to

Keyboard shortcuts

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