cmdhandle

package
v0.0.6-alpha Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2020 License: MIT Imports: 27 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ExitOk the process was executed without errors
	ExitOk = 0
	// ExitByStopReason the process stopped because of a defined reason
	ExitByStopReason = 101
	// ExitNoCode means there was no code associated
	ExitNoCode = 102
	// ExitCmdError means the execution of the command fails. a error by the command itself
	ExitCmdError = 103
	// ExitByRequirement means a requirement was not fulfills
	ExitByRequirement = 104
)
View Source
const (
	// DefaultExecFile is the filename of the script defaut file
	DefaultExecFile = "/.context.json"

	// DefaultExecYaml is the default yaml configuration file
	DefaultExecYaml = "/.contxt.yml"

	// TargetScript is script default target
	TargetScript = "script"

	// InitScript is script default target
	InitScript = "init"

	// ClearScript is script default target
	ClearScript = "clear"

	// TestScript is teh test target
	TestScript = "test"

	// DefaultCommandFallBack is used if no command is defined
	DefaultCommandFallBack = "bash"
)

Variables

This section is empty.

Functions

func AddData

func AddData(key string, data map[string]interface{})

AddData adds a Data Map to the storage

func AddJSON

func AddJSON(key, jsonString string) error

AddJSON imports data by a json String

func ClearAll

func ClearAll()

ClearAll removes all entries

func ClearAllData

func ClearAllData()

ClearAllData removes all entries

func CreateImport

func CreateImport(path string, pathToAdd string) error

CreateImport creates import settings

func CreateMirror

func CreateMirror(path string)

CreateMirror creates nested directories

func ExecPathFile

func ExecPathFile(waitGroup *sync.WaitGroup, useWaitGroup bool, template configure.RunConfig, target string) int

ExecPathFile executes the default exec file

func ExecuteScriptLine

func ExecuteScriptLine(ShellToUse string, cmdArg []string, command string, callback func(string) bool, startInfo func(*os.Process)) (int, int, error)

ExecuteScriptLine executes a simple shell script

func ExecuteTemplateWorker

func ExecuteTemplateWorker(waitGroup *sync.WaitGroup, useWaitGroup bool, target string, template configure.RunConfig)

ExecuteTemplateWorker runs ExecCurrentPathTemplate in context of a waitgroup

func FindTemplate

func FindTemplate() (string, bool)

FindTemplate searchs for Template files in different spaces

func GetData

func GetData(key string) (bool, map[string]interface{})

GetData returns a data Map by the key. or nil if nothing is stored

func GetDataKeys

func GetDataKeys() []string

GetDataKeys returns all current keys

func GetJSONPathResult

func GetJSONPathResult(key, path string) (gjson.Result, bool)

GetJSONPathResult returns the value depending key and path as string

func GetJSONPathValueString

func GetJSONPathValueString(key, path string) string

GetJSONPathValueString returns the value depending key and path as string

func GetLogger

func GetLogger() *logrus.Logger

GetLogger is the main Logger instance

func GetPH

func GetPH(key string) string

GetPH the content og the key

func GetParsedTemplateSource

func GetParsedTemplateSource(path string) (string, error)

GetParsedTemplateSource Returns the soucecode of the template including parsing placeholders

func GetPwdTemplate

func GetPwdTemplate(path string) (configure.RunConfig, error)

GetPwdTemplate returns the template path if exists. it also parses the content of the template against imports and handles them

func GetTemplate

func GetTemplate() (configure.RunConfig, string, bool)

GetTemplate return current template

func HandleJSONMap

func HandleJSONMap(tmpl string, m map[string]interface{}) (string, error)

HandleJSONMap parsing json content for text/template

func HandlePlaceHolder

func HandlePlaceHolder(line string) string

HandlePlaceHolder replaces all defined placeholders

func ImportDataFromJSONFile

func ImportDataFromJSONFile(key string, filename string) error

ImportDataFromJSONFile imports a map from a json file and assign it to a key

func ImportDataFromYAMLFile

func ImportDataFromYAMLFile(key string, filename string) error

ImportDataFromYAMLFile imports a map from a json file and assign it to a key

func ImportFileContent

func ImportFileContent(filename string) (string, error)

ImportFileContent imports a file and returns content as string

func ImportFolder

func ImportFolder(path string, templatePath string) (map[string]interface{}, error)

ImportFolder reads folder recusiv and reads all .json, .yml and .yaml files

func ImportFolders

func ImportFolders(templatePath string, paths ...string) (string, error)

ImportFolders import a list of folders recusiv

func ImportJSONFile

func ImportJSONFile(fileName string) (map[string]interface{}, error)

ImportJSONFile imports a json file for reading

func ImportYAMLFile

func ImportYAMLFile(filename string) (map[string]interface{}, error)

ImportYAMLFile imports a yaml file as used for json map

func LintOut

func LintOut(leftcnt, rightcnt int, all bool)

LintOut prints the source code and the parsed content in a table view, and marks configured and not configured entries with dfferent colors

func LoadIncTempalte

func LoadIncTempalte(path string) (string, bool)

LoadIncTempalte check if .inc.contxt.yml files exists and if this is the case the content will be loaded and all defined paths used to get values for parsing the template file

func MainExecute

func MainExecute()

MainExecute runs main. parsing flags

func MergeVariableMap

func MergeVariableMap(mapin map[string]interface{}, maporigin map[string]interface{}) map[string]interface{}

MergeVariableMap merges two maps

func RunTargets

func RunTargets(targets string)

RunTargets executes multiple targets

func SetPH

func SetPH(key, value string)

SetPH add key value pair

func ShowAsYaml

func ShowAsYaml()

ShowAsYaml prints the generated source of the task file

func TryParse

func TryParse(script []string, regularScript func(string) (bool, int)) (bool, int, []string)

TryParse to parse a line and set a value depending on the line command

func WriteTemplate

func WriteTemplate()

WriteTemplate create path based execution file

func YAMLToMap

func YAMLToMap(source string) (map[string]interface{}, error)

YAMLToMap Convert yaml source string into map

Types

This section is empty.

Jump to

Keyboard shortcuts

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