ext

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2026 License: GPL-3.0 Imports: 29 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SHUFFLE_MODE_KEY     = "shuffle"
	LAST_REVIEW_MODE_KEY = "lastreview"
	CREATED_AT_MODE_KEY  = "createdat"
	LINEAR_MODE_KEY      = "linear"
)
View Source
const (
	Reset     = "\033[0m"
	Yellow    = "\033[33m"
	ClearLine = "\033[K" // Wipes out old text to prevent text ghosting
)
View Source
const (
	BASIC_RENDERER = "basic"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type PluginManifest

type PluginManifest struct {
	Name        string `toml:"name"`
	Alias       string `toml:"alias,omitempty"`
	Version     string `toml:"version"`
	Author      string `toml:"author"`
	Description string `toml:"description"`
	Executable  string `toml:"executable"`

	Capabilities struct {
		ReviewProcessor bool `toml:"review_processor"`
		Renderer        bool `toml:"renderer"`
		UpdateCard      bool `toml:"update_card"`
	} `toml:"capabilities"`
}

PluginManifest represents the structured data required inside every plugin.toml file

func FindCapabilityPlugins

func FindCapabilityPlugins(a *app.App, capabilityName string) ([]*PluginManifest, []string, error)

FindCapabilityPlugins searches the plugins directory and finds all matching plugins of the same capability

func FindPlugin

func FindPlugin(a *app.App, name string, capabilityName string) (*PluginManifest, string, error)

FindPlugin searches plugins directory for the first plugin that matches name and capability

type Renderer

type Renderer interface {
	Render(ctx context.Context, card database.Flashcard, cardNum int, cardCount int, modifiers []string) (string, string, string, error)
	Init(ctx context.Context) (string, string, string, error)
}

///////////////////////////////////////////////////////////// Renderer {{{

func DispenseRenderer

func DispenseRenderer(a *app.App, name string) (Renderer, func(), error)

returned cleanup func must have its call deferred

type ReviewProcessor

type ReviewProcessor interface {
	Process(ctx context.Context, dbCards []database.Flashcard, modifiers []string) ([]database.Flashcard, error)
}

///////////////////////////////////////////////////////////// ReviewProcessor {{{

func DispenseReviewProcessor

func DispenseReviewProcessor(a *app.App, mode string) (ReviewProcessor, func(), error)

type UpdateCard

type UpdateCard interface {
	UserPrompts(ctx context.Context, card database.Flashcard) ([]string, error)
	Process(ctx context.Context, pluginName string, card database.Flashcard, userResponse string, promptIdx int, filters map[string]string, modifiers []string) (database.Flashcard, bool, string, error)
}

///////////////////////////////////////////////////////////// UpdateCard Capability {{{

type UpdateCardCollection

type UpdateCardCollection struct {
	// contains filtered or unexported fields
}

UpdateCardCollection holds a slice of UpdateCard structs and offers a run function that runs them all sequentially

func DispenseUpdateCard

func DispenseUpdateCard(a *app.App) (UpdateCardCollection, func(), error)

func (UpdateCardCollection) Run

func (c UpdateCardCollection) Run(ctx context.Context, a *app.App, cardIn database.Flashcard, filters map[string]string, modifiers []string, inputChan chan string, back string) error

Jump to

Keyboard shortcuts

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