qaengine

package
v0.3.13 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2024 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddCaches

func AddCaches(cacheFiles ...string)

AddCaches adds cache responders. Later cache files override earlier cache files. [base.yaml, project.yaml, service.yaml]

func AddEngine

func AddEngine(e Engine)

AddEngine appends an engine to the engines slice

func AddEngineHighestPriority

func AddEngineHighestPriority(e Engine) error

AddEngineHighestPriority adds an engine to the list and sets it at highest priority

func AddRightAlignedString added in v0.3.12

func AddRightAlignedString(original, addition string) string

AddRightAlignedString adds a new string to the right of the original, with max width the size of the current terminal window

func FetchAnswer

func FetchAnswer(prob qatypes.Problem) (qatypes.Problem, error)

FetchAnswer fetches the answer for the question

func FetchBoolAnswer

func FetchBoolAnswer(probid, desc string, context []string, def bool, validator func(interface{}) error) bool

FetchBoolAnswer asks a confirm type question and gets a boolean as the answer

func FetchMultiSelectAnswer

func FetchMultiSelectAnswer(probid, desc string, context, def, options []string, validator func(interface{}) error) []string

FetchMultiSelectAnswer asks a multi-select type question and gets a slice of strings as the answer

func FetchMultilineInputAnswer

func FetchMultilineInputAnswer(probid, desc string, context []string, def string, validator func(interface{}) error) string

FetchMultilineInputAnswer asks a multi-line type question and gets a string as the answer

func FetchPasswordAnswer

func FetchPasswordAnswer(probid, desc string, context []string, validator func(interface{}) error) string

FetchPasswordAnswer asks a password type question and gets a string as the answer

func FetchSelectAnswer

func FetchSelectAnswer(probid, desc string, context []string, def string, options []string, validator func(interface{}) error) string

FetchSelectAnswer asks a select type question and gets a string as the answer

func FetchStringAnswer

func FetchStringAnswer(probid, desc string, context []string, def string, validator func(interface{}) error) string

FetchStringAnswer asks a input type question and gets a string as the answer

func SetupConfigFile

func SetupConfigFile(writeConfigFile string, configStrings, configFiles, presets []string, persistPasswords bool)

SetupConfigFile adds config responders - should be called only once

func SetupWriteCacheFile

func SetupWriteCacheFile(writeCachePath string, persistPasswords bool)

SetupWriteCacheFile adds write cache

func StartEngine

func StartEngine(qaskip bool, qaport int, qadisablecli bool)

StartEngine starts the QA Engines

func ValidateProblem

func ValidateProblem(prob qatypes.Problem) error

ValidateProblem validates the problem object.

func WriteStoresToDisk

func WriteStoresToDisk() error

WriteStoresToDisk forces all the stores to write their contents out to disk

Types

type CliEngine

type CliEngine struct {
}

CliEngine handles the CLI based qa

func (*CliEngine) FetchAnswer

func (c *CliEngine) FetchAnswer(prob qatypes.Problem) (qatypes.Problem, error)

FetchAnswer fetches the answer using cli

func (*CliEngine) IsInteractiveEngine

func (*CliEngine) IsInteractiveEngine() bool

IsInteractiveEngine returns true if the engine interacts with the user

func (*CliEngine) StartEngine

func (*CliEngine) StartEngine() error

StartEngine starts the cli engine

type DefaultEngine

type DefaultEngine struct {
}

DefaultEngine returns default values for all questions

func NewDefaultEngine

func NewDefaultEngine() *DefaultEngine

NewDefaultEngine creates a new instance of default engine

func (*DefaultEngine) FetchAnswer

func (*DefaultEngine) FetchAnswer(problem qatypes.Problem) (qatypes.Problem, error)

FetchAnswer fetches the default answers

func (*DefaultEngine) IsInteractiveEngine

func (*DefaultEngine) IsInteractiveEngine() bool

IsInteractiveEngine returns true if the engine interacts with the user

func (*DefaultEngine) StartEngine

func (*DefaultEngine) StartEngine() error

StartEngine starts the default qa engine

type Engine

type Engine interface {
	StartEngine() error
	IsInteractiveEngine() bool
	FetchAnswer(prob qatypes.Problem) (ans qatypes.Problem, err error)
}

Engine defines interface for qa engines

func NewCliEngine

func NewCliEngine() Engine

NewCliEngine creates a new instance of cli engine

func NewHTTPRESTEngine

func NewHTTPRESTEngine(qaport int) Engine

NewHTTPRESTEngine creates a new instance of Http REST engine

type HTTPRESTEngine

type HTTPRESTEngine struct {
	// contains filtered or unexported fields
}

HTTPRESTEngine handles qa using HTTP REST services

func (*HTTPRESTEngine) FetchAnswer

func (h *HTTPRESTEngine) FetchAnswer(prob qatypes.Problem) (qatypes.Problem, error)

FetchAnswer fetches the answer using a REST service

func (*HTTPRESTEngine) IsInteractiveEngine

func (*HTTPRESTEngine) IsInteractiveEngine() bool

IsInteractiveEngine returns true if the engine interacts with the user

func (*HTTPRESTEngine) StartEngine

func (h *HTTPRESTEngine) StartEngine() error

StartEngine starts the QA Engine

type StoreEngine

type StoreEngine struct {
	// contains filtered or unexported fields
}

StoreEngine handles cache

func NewStoreEngineFromCache

func NewStoreEngineFromCache(cacheFile string, persistPasswords bool) *StoreEngine

NewStoreEngineFromCache creates a new cache instance

func (*StoreEngine) FetchAnswer

func (se *StoreEngine) FetchAnswer(prob qatypes.Problem) (qatypes.Problem, error)

FetchAnswer fetches the answer from the store

func (*StoreEngine) IsInteractiveEngine

func (*StoreEngine) IsInteractiveEngine() bool

IsInteractiveEngine returns true if the engine interacts with the user

func (*StoreEngine) StartEngine

func (se *StoreEngine) StartEngine() error

StartEngine loads the config from the store

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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