taskrun

package module
v0.0.0-...-3dbd443 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2024 License: MIT Imports: 39 Imported by: 2

Documentation

Overview

Copyright (c) 2020 Thomas Ziegler <thomas.zglr@googlemail.com>. All rights reserved.

Licensed under the MIT License

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Copyright (c) 2020 Thomas Ziegler <thomas.zglr@googlemail.com>. All rights reserved.

Licensed under the MIT License

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Package to decide what path is ment by some inputs, and also creates a label for them, if not set

Copyright (c) 2020 Thomas Ziegler <thomas.zglr@googlemail.com>. All rights reserved.

Licensed under the MIT License

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Copyright (c) 2020 Thomas Ziegler <thomas.zglr@googlemail.com>. All rights reserved.

Licensed under the MIT License

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Copyright (c) 2020 Thomas Ziegler <thomas.zglr@googlemail.com>. All rights reserved.

Licensed under the MIT License

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Copyright (c) 2020 Thomas Ziegler <thomas.zglr@googlemail.com>. All rights reserved.

Licensed under the MIT License

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

collection of comands they can be used for any comand interpreter like cobra and ishell.

Copyright (c) 2020 Thomas Ziegler <thomas.zglr@googlemail.com>. All rights reserved.

Licensed under the MIT License

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Copyright (c) 2020 Thomas Ziegler <thomas.zglr@googlemail.com>. All rights reserved.

Licensed under the MIT License

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Copyright (c) 2020 Thomas Ziegler <thomas.zglr@googlemail.com>. All rights reserved.

Licensed under the MIT License

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Copyright (c) 2020 Thomas Ziegler <thomas.zglr@googlemail.com>. All rights reserved.

Licensed under the MIT License

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Copyright (c) 2020 Thomas Ziegler <thomas.zglr@googlemail.com>. All rights reserved.

Licensed under the MIT License

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Copyright (c) 2020 Thomas Ziegler <thomas.zglr@googlemail.com>. All rights reserved.

Licensed under the MIT License

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Index

Constants

View Source
const (
	EventAllLines         = "ExecuteScriptLine" // EventAllLines is the event name for sending all lines
	EventTaskStatusUpdate = "TaskStatus"        // EventTaskStatusUpdate is the event name for sending task status updates
)
View Source
const (
	// DefaultExecFile is the filename of the script defaut file
	DefaultExecFile = string(os.PathSeparator) + ".context.json"

	// DefaultExecYaml is the default yaml configuration file
	DefaultExecYaml = string(os.PathSeparator) + ".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"

	// On windows we have a different default
	DefaultCommandFallBackWindows = "powershell"
)
View Source
const (
	PWRSHELL_CMD_VERSION        = "$PSVersionTable.PSVersion.Major"                                      // powershell cmd to get actual version
	PWRSHELL_CMD_PROFILE        = "$PROFILE"                                                             // powershell cmd to get actual profile
	PWRSHELL_CMD_TEST_PROFILE   = `Test-Path -Path $PROFILE.CurrentUserCurrentHost`                      // powershell cmd to test if profile exists
	PWRSHELL_CMD_PROFILE_CREATE = `New-Item -Path $PROFILE.CurrentUserCurrentHost -ItemType File -Force` // powershell cmd to create profile
)

Variables

View Source
var PreHook func(msg ...interface{}) bool = nil

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 AppendToPH

func AppendToPH(key, value string) bool

func BashUser

func BashUser()

func CallBackNewWs

func CallBackNewWs(newWs string)

func CallBackOldWs

func CallBackOldWs(oldws string) bool

func CheckOrCreateUseConfig

func CheckOrCreateUseConfig(externalUseCase string) (string, error)

CheckOrCreateUseConfig get a usecase like swaros/ctx-git and checks if a local copy of them exists. if they not exists it creates the local directoy and uses git to clone the content. afterwards it writes a version.conf in the forlder above of content and stores the current hashes

func ClearAll

func ClearAll()

ClearAll removes all entries

func ClearAllData

func ClearAllData()

ClearAllData removes all entries

func CopyPlaceHolder2Origin

func CopyPlaceHolder2Origin()

copies the placeholder to the origin map so there can be used in templates to this should be done after initilize the application. but not while runtime

func CreateImport

func CreateImport(path string, pathToAdd string) error

CreateImport creates import settings

func CtxOut

func CtxOut(msg ...interface{})

func DecidePath

func DecidePath(searchWords, paths []string) (path string, found bool)

func DirFind

func DirFind(args []string) string

DirFind returns the best matching part of depending the arguments, what of the stored paths would be the expected one

func DirFindApplyAndSave

func DirFindApplyAndSave(args []string) (string, error)

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, error) bool, startInfo func(*os.Process)) (int, int, error)

ExecuteScriptLine executes a simple shell script returns internal exitsCode, process existcode, error

func ExecuteTemplateWorker

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

ExecuteTemplateWorker runs ExecCurrentPathTemplate in context of a waitgroup

func ExistInStrMap

func ExistInStrMap(testStr string, check []string) bool

func ExportTask

func ExportTask(target string) (string, error)

func ExportVarToFile

func ExportVarToFile(variable string, filename string) error

func FindIndexByPath

func FindIndexByPath(path string) (index string, ok bool)

func FindPwrShellProfile

func FindPwrShellProfile() (bool, string)

func FindTemplate

func FindTemplate() (string, bool)

FindTemplate searchs for Template files in different spaces

func FindWorkspaceInfoByTemplate

func FindWorkspaceInfoByTemplate(updateFn func(workspace string, cnt int, update bool, info configure.WorkspaceInfoV2)) (allCount int, updatedCount int)

FindWorkspaceInfoByTemplate is searching for a template file and if found, it will set the project and role from the template file to the workspace info this is only done if the workspace info is not set yet this is automatically done on each workspace, if the workspace is not set yet but only on the command switch and 'dir add'

func FishCompletionUpdate

func FishCompletionUpdate(cmd *cobra.Command)

FishCompletionUpdate updates the fish completion file

func FishFunctionUpdate

func FishFunctionUpdate()

func FishUpdate

func FishUpdate(cmd *cobra.Command)

FishFunctionUpdate updates the fish function file and adds code completion for the fish shell

func GetAllTargets

func GetAllTargets() ([]string, bool)

func GetArgQuotedEntries

func GetArgQuotedEntries(oristr string) ([]string, bool)

func GetColorEnabled

func GetColorEnabled() bool

func GetContxtBasePath

func GetContxtBasePath() (string, error)

GetContxtBasePath returns the full path to the contxt base directory

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 GetDataAsJson

func GetDataAsJson(key string) (bool, string)

GetDataAsJson converts the map given by key infto a yaml string

func GetDataAsYaml

func GetDataAsYaml(key string) (bool, string)

GetDataAsYaml converts the map given by key infto a yaml string

func GetDataKeys

func GetDataKeys() []string

GetDataKeys returns all current keys

func GetDefaultCmd

func GetDefaultCmd() string

func GetDefaultCmdOpts

func GetDefaultCmdOpts(ShellToUse string, cmdArg []string) []string

func GetExecDefaults

func GetExecDefaults() (string, []string)

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 GetOriginMap

func GetOriginMap() map[string]interface{}

func GetPH

func GetPH(key string) string

GetPH the content of the key. but at least a empty string if not exists. so this is not usefull to test if the PH was set.

func GetPHExists

func GetPHExists(key string) (string, bool)

GetPH the content of the key as string. if exists.

func GetParsedTemplateSource

func GetParsedTemplateSource(path string) (string, error)

GetParsedTemplateSource Returns the soucecode of the template including parsing placeholders

func GetPlaceHoldersFnc

func GetPlaceHoldersFnc(inspectFunc func(phKey string, phValue string))

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 GetSharedPath

func GetSharedPath(sharedName string) (string, error)

GetSharedPath returns the full path to the shared repository

func GetTemplate

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

GetTemplate return current template, the absolute path,if it exists, any error

func GetUseInfo

func GetUseInfo(usecase, _ string) (string, string)

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 HandlePlaceHolderWithScope

func HandlePlaceHolderWithScope(line string, scopeVars map[string]string) string

func HandleUsecase

func HandleUsecase(externalUseCase string) string

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, _ string) (map[string]interface{}, error)

ImportFolder reads folder recursiv 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 InitDefaultVars

func InitDefaultVars()

func InitWsVariables

func InitWsVariables()

InitWsVariables is setting up variables depending the current found configuration (.contxt.yml)

func LintOut

func LintOut(leftcnt, rightcnt int, all bool, noOut bool) 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 ListUseCases

func ListUseCases(fullPath bool) ([]string, error)

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 MainInit

func MainInit()

MainInit initilaize the Application. this is required for any entrie-point currently we have two of them. by running in interactive in ishell, and by running with parameters.

func MergeVariableMap

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

MergeVariableMap merges two maps

func ParseFileAsTemplate

func ParseFileAsTemplate(path string) (string, error)

func PrintCnPaths

func PrintCnPaths()

func PwrShellCompletionUpdate

func PwrShellCompletionUpdate(cmd *cobra.Command)

func PwrShellExec

func PwrShellExec(cmd string) string

func PwrShellForceCreateProfile

func PwrShellForceCreateProfile()

func PwrShellTestProfile

func PwrShellTestProfile() bool

func PwrShellUpdate

func PwrShellUpdate(cmd *cobra.Command)

func PwrShellUser

func PwrShellUser()

func ResetAllTaskInfos

func ResetAllTaskInfos()

ResetAllTaskInfos resets all task infos

func ResetVariables

func ResetVariables()

func RunShared

func RunShared(targets string)

func RunTargets

func RunTargets(targets string, sharedRun bool)

RunTargets executes multiple targets the targets string can have multiple targets seperated by comma

func SetColorEnabled

func SetColorEnabled(enabled bool)

func SetIfNotExists

func SetIfNotExists(key, value string)

func SetJSONValueByPath

func SetJSONValueByPath(key, path, value string) error

func SetPH

func SetPH(key, value string)

SetPH add key value pair

func SharedFolderExecuter

func SharedFolderExecuter(template configure.RunConfig, locationHandle func(string, string))

SharedFolderExecuter runs shared .contxt.yml files directly without merging them into the current contxt file

func ShowAsYaml

func ShowAsYaml(fullparsed bool, trySupress bool, indent int)

ShowAsYaml prints the generated source of the task file

func ShowPaths

func ShowPaths(current string)

ShowPaths : display all stored paths in the workspace

func SplitArgs

func SplitArgs(cmdList []string, prefix string, arghandler func(string, map[string]string)) []string

func SplitQuoted

func SplitQuoted(oristr string, sep string) []string

func StringMatchTest

func StringMatchTest(pattern, value string) bool

StringMatchTest test a pattern and a value. in this example: myvar: "=hello" the patter is "=hello" and the value should be "hello" for a match

func StringSplitArgs

func StringSplitArgs(argLine string, prefix string) (string, map[string]string)

func StripContxtUseDir

func StripContxtUseDir(path string) string

func TaskExists

func TaskExists(target string) bool

TaskExists checks if a task is already created

func TaskRunning

func TaskRunning(target string) bool

TaskRunning checks if a task is already running

func TaskRunsAtLeast

func TaskRunsAtLeast(target string, atLeast int) bool

checks if a task was at least started X times

func TestTemplate

func TestTemplate() error

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 UpdateOriginMap

func UpdateOriginMap(mapData map[string]interface{})

UpdateOriginMap updates the main templating map with an new one

func UpdateUseCase

func UpdateUseCase(fullPath string)

func UserDirectory

func UserDirectory() (string, error)

func WaitForTasksDone

func WaitForTasksDone(tasks []string, timeOut, tickTime time.Duration, stillWait func() bool, isDone func(), timeOutHandle func(), notStartet func(string, string, map[string]string) bool)

WaitForTasksDone waits until all the task are done triggers a callback for any tick and one if the state DONE is reached there is an timeout as maximum time to wait if this time is reached the process will be continued and the timeout callback is triggered the callback for notStarted must return true if they handle this issue. on returning false it will be counted as isDone

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

func ZshFuncDir

func ZshFuncDir() string

try to get the best path by reading the permission because zsh seems not be used in windows, we stick to linux related permission check

func ZshUpdate

func ZshUpdate(cmd *cobra.Command)

func ZshUser

func ZshUser()

Types

type CtxOutCtrl

type CtxOutCtrl struct {
	IgnoreCase bool
}

type CtxOutLabel

type CtxOutLabel struct {
	Message interface{}
	FColor  string
}

func InfoF

func InfoF(val interface{}) CtxOutLabel

func InfoMinor

func InfoMinor(val interface{}) CtxOutLabel

func InfoRed

func InfoRed(val interface{}) CtxOutLabel

func LabelErrF

func LabelErrF(val interface{}) CtxOutLabel

func LabelFY

func LabelFY(val interface{}) CtxOutLabel

func LabelOkF

func LabelOkF(val interface{}) CtxOutLabel

func ValF

func ValF(val interface{}) CtxOutLabel

type CtxTargetOut

type CtxTargetOut struct {
	ForeCol     string
	BackCol     string
	SplitLabel  string
	Target      string
	Alternative string
	PanelSize   int
}

type CtxUi

type CtxUi struct {
	LogOutMessage string
	// contains filtered or unexported fields
}

func InitWindow

func InitWindow(cmd *cobra.Command, args []string) (*CtxUi, error)

func (*CtxUi) CreatePathSelectPage

func (ui *CtxUi) CreatePathSelectPage() *tview.Flex

func (*CtxUi) CreateRunPage

func (ui *CtxUi) CreateRunPage() *tview.Flex

CreateRunPage builds the page that contains different elements to inspect and run the targets

func (*CtxUi) CreateWorkSpacePage

func (ui *CtxUi) CreateWorkSpacePage() *tview.Flex

func (*CtxUi) FilterOutPut

func (ui *CtxUi) FilterOutPut(caseHandle func(target string, msg []interface{}), msg ...interface{}) []interface{}

FilterOutPut parses the content and handles all interface depending the Type differently

func (*CtxUi) UpdateAll

func (ui *CtxUi) UpdateAll()

func (*CtxUi) UpdatePathList

func (ui *CtxUi) UpdatePathList()

type EventScriptLine

type EventScriptLine struct {
	Line   string
	Target string
	Error  error
}

type EventTaskStatus

type EventTaskStatus struct {
	Target   string
	Running  bool
	Finished bool
	RunCount int
	Error    error
	ExitCode int
	Pid      int
}

type TaskDef

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

TaskDef holds information about running and finished tasks

Jump to

Keyboard shortcuts

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