commandline

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2020 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CLI

type CLI struct {
	Parser    Parser
	Service   ServiceCaller
	Writer    io.Writer
	ErrWriter io.Writer
	Config    Config
}

CLI : The command line interface struct

func (CLI) Exec

func (c CLI) Exec(args []string, models []model.Data) (*cli.App, int)

Exec : Parses the given API models, validates and executes the given command line arguments

type Config

type Config struct {
	Profiles []profile `yaml:"profiles"`
}

Config contains the parsed YAML data from the systemlink.yaml configuration file

func NewConfig

func NewConfig(input []byte, baseDir string) (Config, error)

NewConfig initializes a new Config structure based on the yaml data in the given byte stream

func (*Config) GetSettings

func (c *Config) GetSettings(profileName string) model.Settings

GetSettings returns the Settings structure with the data from the selected profile of the yaml configuration file

type Parser

type Parser interface {
	Parse(models []model.Data) ([]model.Definition, error)
}

Parser interface which turns the given byte stream into a structured service definition model with all declared operations.

type ServiceCaller

type ServiceCaller interface {
	Call(operation model.Operation, parameterValues []model.ParameterValue, settings model.Settings) (int, string, error)
}

ServiceCaller interface abstracts calling the external services. The Call function takes in a model describing the API of the service as well as the provided parameters.

type ValueConverter

type ValueConverter struct{}

ValueConverter provides functions to convert between input data of the command line and the data types in the model

func (ValueConverter) ConvertValues

func (c ValueConverter) ConvertValues(values map[string]string, parameters []model.Parameter) ([]model.ParameterValue, error)

ConvertValues converts the given input parameter strings into to defined types of the model parameters

Jump to

Keyboard shortcuts

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