conv

package
v0.0.0-...-911daf2 Latest Latest
Warning

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

Go to latest
Published: Jun 17, 2022 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Execute

func Execute()

func GetPluginDir

func GetPluginDir() string

func PrintOut

func PrintOut(input *ConvInput, output *ConvOutput)

func PrintUsage

func PrintUsage()

Types

type ConvInput

type ConvInput struct {
	Value    string
	FromUnit string
	ToUnit   string
	Context  string
	Verbose  bool
	Raw      bool
}

func ParseArgs

func ParseArgs() *ConvInput

func (*ConvInput) String

func (in *ConvInput) String() string

func (*ConvInput) ToPluginInput

func (in *ConvInput) ToPluginInput(flags map[string]string) *PluginInput

type ConvOutput

type ConvOutput struct {
	Value   string
	Unit    string
	Context string
}

func (*ConvOutput) Raw

func (out *ConvOutput) Raw() string

func (*ConvOutput) String

func (out *ConvOutput) String() string

func (*ConvOutput) Verbose

func (out *ConvOutput) Verbose() string

type ConvPlugin

type ConvPlugin interface {
	Run(in *PluginInput) (*PluginOutput, error)
	Context() string
	Units() []string
}

type PluginInput

type PluginInput struct {
	Value    string
	FromUnit string
	ToUnit   string
	Flags    map[string]string
}

type PluginOutput

type PluginOutput struct {
	Value string
	Unit  string
}

type PluginStorage

type PluginStorage struct {
	Plugins map[string]ConvPlugin
	Units   map[string]string
}

func LoadPlugins

func LoadPlugins(pluginDir string) *PluginStorage

func (*PluginStorage) SendToPlugin

func (pluginStorage *PluginStorage) SendToPlugin(input *ConvInput) (*ConvOutput, error)

Jump to

Keyboard shortcuts

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