help

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2024 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (

	//go:embed builtins.yaml
	BUILTIN_HELP_YAML string

	//go:embed language.yaml
	LANGUAGE_HELP_YAML string
)

Functions

func ForeachTopicGroup

func ForeachTopicGroup(fn func(name string, group TopicGroup))

func Help

func Help(ctx *core.Context, args ...core.Value)

func HelpFor

func HelpFor(s string, config HelpMessageConfig) (string, bool)

func HelpForGoFunc

func HelpForGoFunc(fn any, config HelpMessageConfig) (string, bool)

func HelpForSymbolicGoFunc

func HelpForSymbolicGoFunc(fn *symbolic.GoFunction, config HelpMessageConfig) (string, bool)

func RegisterHelpValue

func RegisterHelpValue(v any, topic string)

func RegisterHelpValues

func RegisterHelpValues(values map[string]any)

Types

type Example

type Example struct {
	Code        string `yaml:"code"`
	Explanation string `yaml:"explanation"`
	Output      string `yaml:"output"`
	Standalone  bool   `yaml:"standalone"` //true if the code can be executed with minor additions
}

type HelpMessageConfig

type HelpMessageConfig struct {
	Format HelpMessageFormat
}

type HelpMessageFormat

type HelpMessageFormat int
const (
	ColorizedTerminalFormat HelpMessageFormat = iota + 1
	MarkdownFormat
)

type TopicGroup

type TopicGroup struct {
	IsNamespace   bool        `yaml:"namespace"`
	Elements      []TopicHelp `yaml:"elements"`
	AboutBuiltins bool
}

type TopicHelp

type TopicHelp struct {
	Value any
	//scalar
	Topic       string `yaml:"topic"`
	Alias       string `yaml:"alias"`
	Summary     string `yaml:"summary"`
	Text        string `yaml:"text"`
	IsNamespace bool   `yaml:"namespace"`

	//lists
	RelatedTopics []string    `yaml:"related-topics"`
	Examples      []Example   `yaml:"examples"`
	SubTopicNames []string    `yaml:"subtopic-names"`
	SubTopics     []TopicHelp `yaml:"subtopics"`
}

func (TopicHelp) Print

func (h TopicHelp) Print(w io.Writer, config HelpMessageConfig)

func (TopicHelp) String

func (h TopicHelp) String(config HelpMessageConfig) string

Jump to

Keyboard shortcuts

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