domain

package
v0.3.6 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2020 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InitConfig added in v0.0.3

func InitConfig() appcontext.Component

InitConfig lazily loads a Config

Types

type Command

type Command struct {
	Name             string           `json:"name"`
	ShortDescription string           `json:"shortDescription"`
	LongDescription  string           `json:"longDescription"`
	Flags            map[string]*Flag `json:"flags"`
	ValidArgs        []string         `json:"validArgs"`
}

Command is an available command in a specific Spell (plugin)

func (*Command) CobraCommand added in v0.0.6

func (command *Command) CobraCommand(runCommandFunction RunCommandFunction) *cobra.Command

CobraCommand creates a cobra.Command from the domain.Command specification

type Config

type Config struct {
	Author        string            `json:"author"`
	License       string            `json:"license"`
	DefaultSpells []GolangLibrary   `json:"defaultSpells"`
	Spellbook     map[string]*Spell `json:"spellbook"`
}

Config holds the Golangspell tool configuration

func BuildDefaultConfig

func BuildDefaultConfig() Config

BuildDefaultConfig used to bootstrap application at first execution

func GetConfig added in v0.0.3

func GetConfig() *Config

GetConfig from the Current Application Context

type ConfigRepository added in v0.0.3

type ConfigRepository interface {
	appcontext.Component
	Get() (*Config, error)
	Save(config *Config) (string, error)
}

ConfigRepository defines the repository capabilities that should be found in a Repository implementation for Config

func GetConfigRepository added in v0.0.3

func GetConfigRepository() ConfigRepository

GetConfigRepository from the Current Application Context

type Flag

type Flag struct {
	Name      string `json:"name"`
	Shorthand string `json:"shorthand"`
	Value     string `json:"value"`
	Usage     string `json:"usage"`
}

Flag s defines special behaviors and configurations to the commands

type GolangLibrary added in v0.0.3

type GolangLibrary struct {
	URL  string `json:"url"`
	Name string `json:"name"`
}

GolangLibrary contains the deployment info of an installed Golang Library

func (*GolangLibrary) BinPath added in v0.0.3

func (golangLibrary *GolangLibrary) BinPath() string

BinPath of the library

func (*GolangLibrary) SrcPath added in v0.0.3

func (golangLibrary *GolangLibrary) SrcPath() string

SrcPath of the library

func (*GolangLibrary) URLToPackage added in v0.0.4

func (golangLibrary *GolangLibrary) URLToPackage() string

URLToPackage returns the package name referenced by the URL

type RunCommandFunction added in v0.0.6

type RunCommandFunction func(cmd *cobra.Command, args []string)

RunCommandFunction specifies a function for running a command

type Spell

type Spell struct {
	Name      string              `json:"name"`
	URL       string              `json:"url"`
	Commands  map[string]*Command `json:"commands"`
	Installed bool                `json:"installed"`
}

Spell maps a Golangspell plugin

func (*Spell) URLToPackage added in v0.0.3

func (spell *Spell) URLToPackage() string

URLToPackage returns the package name referenced by the URL

Jump to

Keyboard shortcuts

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