Version: v0.0.0-...-0606ef9 Latest Latest

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

Go to latest
Published: May 24, 2020 License: LGPL-3.0 Imports: 2 Imported by: 0




This section is empty.


This section is empty.


func CleanupModules

func CleanupModules()

CleanupModules removes all module registrations

func GetModuleHelp

func GetModuleHelp(typ, name string) error

GetModuleHelp calls the help function of the module identified by typ, name

func RegisterModule

func RegisterModule(typ, name, desc string, new ModuleCreator, help ModuleHelp)

RegisterModule registers a module with given type, name, description, module creator, and help function. Existing modules are overwritten.


type Module

type Module interface {
	ID() string

Module interface. Modules need at least an ID() function returning suitable string representation and an Init() function, which is called after all the arguments were successfully parsed and all the modules created.

func CreateModule

func CreateModule(typ, which string, args []string) ([]string, Module, error)

CreateModule creates the module with the given type, name, and the provided options

type ModuleCreator

type ModuleCreator func([]string) ([]string, Module, error)

ModuleCreator is a function, which creates a module. It is provided a list of string options. It needs to return the not used string options and the created Module.

type ModuleDescription

type ModuleDescription struct {
	// contains filtered or unexported fields

ModuleDescription contains name and description of a module

func GetModules

func GetModules(typ string) (descriptions []ModuleDescription, err error)

GetModules returns the descriptions of the registered modules ordered by name

func (ModuleDescription) Description

func (m ModuleDescription) Description() string

Description returns the description of this module

func (ModuleDescription) Name

func (m ModuleDescription) Name() string

Name returns the name of this module

type ModuleHelp

type ModuleHelp func(string)

ModuleHelp is provided the name of the module and must produce a help description on stderr.

Source Files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL