app

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BackendKey

func BackendKey(input domain.Format, output domain.Format) string

BackendKey builds the pair key used in Preferences.Backends.

Types

type CommandStatus

type CommandStatus struct {
	Name  string
	Found bool
	Hints []ports.InstallSuggestion
}

type ConvertRequest

type ConvertRequest struct {
	Inputs       []string
	OutputPath   string
	InputFormat  domain.Format
	OutputFormat domain.Format
	OutputDir    string
	SourceDirOut bool
	Overwrite    bool
	Quality      int
	Action       domain.TransformAction
	Resize       string
	ToolOptions  domain.ToolOptions
}

type DependencyStatus

type DependencyStatus struct {
	Backend     string
	Description string
	Commands    []CommandStatus
}

type InteractiveRequest

type InteractiveRequest struct {
	Root         string
	Inputs       []string
	InputFormat  domain.Format
	OutputFormat domain.Format
	OutputDir    string
	SourceDirOut bool
	Overwrite    bool
	Quality      int
	Action       domain.TransformAction
	Resize       string
	ToolOptions  domain.ToolOptions
}

type JobReport

type JobReport struct {
	InputPath    string
	OutputPath   string
	InputFormat  domain.Format
	OutputFormat domain.Format
	Backend      string
	Command      string
	Status       ReportStatus
	Message      string
	Err          error
	InstallHints []ports.InstallSuggestion
}

type PairPreference

type PairPreference struct {
	Input       domain.Format
	Output      domain.Format
	Tools       []string
	ToolOptions domain.ToolOptions
}

type Preferences

type Preferences struct {
	Pairs       []PairPreference
	ToolOptions domain.ToolOptions
	// Backends maps "input->output" pair keys or bare "input" format keys
	// to ordered preferred backend IDs. When a preferred backend is
	// installed, it is used without asking.
	Backends map[string][]string
}

func (Preferences) OptionsFor

func (p Preferences) OptionsFor(input domain.Format, output domain.Format) domain.ToolOptions

func (Preferences) OrderConverters

func (p Preferences) OrderConverters(input domain.Format, output domain.Format, converters []ports.Converter) []ports.Converter

func (Preferences) PreferredConverter

func (p Preferences) PreferredConverter(input domain.Format, output domain.Format, available []ports.Converter) ports.Converter

PreferredConverter returns the first installed converter matching a configured backend preference for this pair, or nil when none is set.

type ReportStatus

type ReportStatus string
const (
	StatusConverted ReportStatus = "converted"
	StatusSkipped   ReportStatus = "skipped"
	StatusFailed    ReportStatus = "failed"
)

type RunReport

type RunReport struct {
	Items []JobReport
}

func (RunReport) Count

func (r RunReport) Count(status ReportStatus) int

func (RunReport) HasFailures

func (r RunReport) HasFailures() bool

type Service

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

func NewService

func NewService(converters []ports.Converter, discovery ports.FileDiscovery, fs ports.FileSystem, prompt ports.Prompt, runner ports.CommandRunner, advisor ports.InstallAdvisor, preferences Preferences, progress ports.ProgressReporter) *Service

func (*Service) BuildJobs

func (s *Service) BuildJobs(req ConvertRequest) ([]domain.ConvertJob, error)

func (*Service) Convert

func (s *Service) Convert(ctx context.Context, req ConvertRequest) (RunReport, error)

func (*Service) Converters

func (s *Service) Converters() []ports.Converter

func (*Service) DependencyStatus

func (s *Service) DependencyStatus() []DependencyStatus

func (*Service) Interactive

func (s *Service) Interactive(ctx context.Context, req InteractiveRequest) (RunReport, error)

func (*Service) OutputFormatChoicesForInputs

func (s *Service) OutputFormatChoicesForInputs(inputs []string, inputOverride domain.Format, requestOptions domain.ToolOptions) ([]ports.FormatChoice, error)

func (*Service) OutputFormatsForInputs

func (s *Service) OutputFormatsForInputs(inputs []string, inputOverride domain.Format) ([]domain.Format, error)

Jump to

Keyboard shortcuts

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