gtcore

package
v0.0.0-...-3a2791a Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2020 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Run

func Run(args []string) error

Run runs the core of "gtc" command.

func SetupDefaultCatalog

func SetupDefaultCatalog(names ...string) error

SetupDefaultCatalog loads/setups DefaultCatalog with tools from JSON files.

Types

type Catalog

type Catalog map[string]Tool

Catalog is a collection of tools.

var DefaultCatalog Catalog

DefaultCatalog provides a catalog of default tools.

func NewCatalog

func NewCatalog(tools ...Tool) Catalog

NewCatalog creates a Catalog from Tool array.

func (Catalog) Merge

func (c Catalog) Merge(tools ...Tool) Catalog

Merge merges tools to a Catalog.

func (Catalog) Names

func (c Catalog) Names() []string

Names returns all name of tools.

func (Catalog) Run

func (c Catalog) Run(args []string) error

Run runs an operation on a Catalog.

type Tool

type Tool struct {
	Path string `json:"path"`
	Desc string `json:"desc"`

	// Name is command name (OPTION). If empty, extract from Path.
	Name string `json:"name,omitempty"`
}

Tool represents a well known tool.

func (Tool) CmdName

func (tool Tool) CmdName() string

CmdName returns name of a tool.

Jump to

Keyboard shortcuts

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