Documentation ¶
Overview ¶
Copyright (c) 2023 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) 2023 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) 2023 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) 2023 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) 2023 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) 2023 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
- Variables
- func AddPathToIncludeImports(incConfig *configure.IncludePaths, pathToAdd string) (string, error)
- func CreateContxtFile() error
- func Init() error
- func MainMenu(tc *ctxtcell.CtCell, c *CmdExecutorImpl)
- func MainScreen(c *CmdExecutorImpl) (*ctxtcell.CtCell, error)
- func NewLogrusLogger() *logrusLogger
- func NewShellInstall(logger mimiclog.Logger) *shellInstall
- func TemplateTargetsAsMap(template configure.RunConfig, showInvTarget bool) ([]string, bool)
- func UserDirectory() (string, error)
- type CmdExecutor
- type CmdExecutorImpl
- func (c *CmdExecutorImpl) AddIncludePath(path string) error
- func (c *CmdExecutorImpl) CallBackNewWs(newWs string)
- func (c *CmdExecutorImpl) CallBackOldWs(oldws string) bool
- func (c *CmdExecutorImpl) Combine4Print(msg ...interface{}) []interface{}
- func (c *CmdExecutorImpl) CreateContxtFile() error
- func (c *CmdExecutorImpl) DecidePath(searchWords, paths []string) (path string, found bool)
- func (c *CmdExecutorImpl) DirFind(args []string) string
- func (c *CmdExecutorImpl) DirFindApplyAndSave(args []string) (string, error)
- func (c *CmdExecutorImpl) FindIndexByPath(path string) (index string, ok bool)
- func (c *CmdExecutorImpl) FindWorkspaceInfoByTemplate(...) (allCount int, updatedCount int)
- func (c *CmdExecutorImpl) GetAllOutputHandlerNames() []string
- func (c *CmdExecutorImpl) GetCurrentWorkSpace() string
- func (c *CmdExecutorImpl) GetLogger() mimiclog.Logger
- func (c *CmdExecutorImpl) GetOuputHandler() (ctxout.StreamInterface, ctxout.PrintInterface)
- func (c *CmdExecutorImpl) GetTargets(incInvisible bool) []string
- func (c *CmdExecutorImpl) GetVariable(name string) string
- func (c *CmdExecutorImpl) GetVariables() map[string]string
- func (c *CmdExecutorImpl) GetWorkspaces() []string
- func (c *CmdExecutorImpl) InitExecuter() error
- func (c *CmdExecutorImpl) InteractiveScreen()
- func (c *CmdExecutorImpl) Lint(showAll bool) error
- func (c *CmdExecutorImpl) MainInit()
- func (c *CmdExecutorImpl) MessageToString(msg ...interface{}) string
- func (c *CmdExecutorImpl) Print(msg ...interface{})
- func (c *CmdExecutorImpl) PrintPaths(plain bool, showFulltask bool)
- func (c *CmdExecutorImpl) PrintShared()
- func (c *CmdExecutorImpl) PrintTemplate()
- func (c *CmdExecutorImpl) PrintVariables(format string)
- func (c *CmdExecutorImpl) PrintWorkspaces()
- func (c *CmdExecutorImpl) Println(msg ...interface{})
- func (c *CmdExecutorImpl) ResetVariables()
- func (c *CmdExecutorImpl) RunAnkoScript(args []string) error
- func (c *CmdExecutorImpl) RunTargets(target string, force bool) error
- func (c *CmdExecutorImpl) SetColor(onoff bool)
- func (c *CmdExecutorImpl) SetLogLevel(level string) error
- func (c *CmdExecutorImpl) SetOutputHandlerByName(name string) error
- func (c *CmdExecutorImpl) SetPreValue(name string, value string)
- func (c *CmdExecutorImpl) SetProjectVariables()
- func (c *CmdExecutorImpl) SetStartupVariables(dataHndl *tasks.CombinedDh, template *configure.RunConfig)
- func (c *CmdExecutorImpl) ShellWithComands(cmds []string, timeout int)
- type CmdSession
- type CobraOptions
- type CtxShell
- type Fields
- type ImportHandler
- type LogrusMimic
- type OutputHandler
- type PlainOutput
- type RandColor
- type RandColorStore
- func (rcs *RandColorStore) GetColorAsCtxMarkup(taskName string) (string, string, string)
- func (rcs *RandColorStore) GetMaxVariants() int
- func (rcs *RandColorStore) GetOrSetIndexColor(taskName string) RandColor
- func (rcs *RandColorStore) GetOrSetRandomColor(taskName string) (RandColor, bool)
- func (rcs *RandColorStore) IsInusage(color RandColor) bool
- func (rcs *RandColorStore) PickUnusedRandColor() (RandColor, bool)
- type SessionCobra
- func (c *SessionCobra) GetAnkoRunCmd() *cobra.Command
- func (c *SessionCobra) GetCreateCmd() *cobra.Command
- func (c *SessionCobra) GetCreateImportCmd() *cobra.Command
- func (c *SessionCobra) GetDirAddCmd() *cobra.Command
- func (c *SessionCobra) GetDirCmd() *cobra.Command
- func (c *SessionCobra) GetDirFindCmd() *cobra.Command
- func (c *SessionCobra) GetDirLsCmd() *cobra.Command
- func (c *SessionCobra) GetDirRmCmd() *cobra.Command
- func (c *SessionCobra) GetGotoCmd() *cobra.Command
- func (c *SessionCobra) GetInstallBashCmd() *cobra.Command
- func (c *SessionCobra) GetInstallCmd() *cobra.Command
- func (c *SessionCobra) GetInstallFishCmd() *cobra.Command
- func (c *SessionCobra) GetInstallPowershellCmd() *cobra.Command
- func (c *SessionCobra) GetInstallZshBaseFunc() *cobra.Command
- func (c *SessionCobra) GetInstallZshCmd() *cobra.Command
- func (c *SessionCobra) GetInstallZshShellScript() *cobra.Command
- func (c *SessionCobra) GetInteractiveCmd() *cobra.Command
- func (c *SessionCobra) GetInteractiveOnceCmd() *cobra.Command
- func (c *SessionCobra) GetLintCmd() *cobra.Command
- func (c *SessionCobra) GetLintTemplateCmd() *cobra.Command
- func (c *SessionCobra) GetListWsCmd() *cobra.Command
- func (c *SessionCobra) GetNewWsCmd() *cobra.Command
- func (c *SessionCobra) GetPrintWsCmd() *cobra.Command
- func (c *SessionCobra) GetRmWsCmd() *cobra.Command
- func (c *SessionCobra) GetRunAtAllCmd() *cobra.Command
- func (c *SessionCobra) GetRunCmd() *cobra.Command
- func (c *SessionCobra) GetScanCmd() *cobra.Command
- func (c *SessionCobra) GetVariablesCmd() *cobra.Command
- func (c *SessionCobra) GetVersionCmd() *cobra.Command
- func (c *SessionCobra) GetWorkspaceCmd() *cobra.Command
- func (c *SessionCobra) Init(cmd CmdExecutor) error
- func (c *SessionCobra) PrintCurrentWs() *cobra.Command
- type SessionLogger
- type SharedHelper
- func (sh *SharedHelper) CheckOrCreateUseConfig(externalUseCase string) (string, error)
- func (sh *SharedHelper) GetBasePath() string
- func (sh *SharedHelper) GetSharedPath(sharedName string) string
- func (sh *SharedHelper) GetSharedPathForUseCase(usecase string) string
- func (sh *SharedHelper) GetUseInfo(usecase, _ string) (string, string)
- func (sh *SharedHelper) HandleUsecase(externalUseCase string) string
- func (sh *SharedHelper) ListUseCases(fullPath bool) ([]string, error)
- func (sh *SharedHelper) MergeRequiredPaths(ctemplate *configure.RunConfig, templateHandler *ctemplate.Template) error
- func (sh *SharedHelper) SetLogger(logger mimiclog.Logger)
- func (sh *SharedHelper) StripContxtUseDir(path string) string
- func (sh *SharedHelper) UpdateUseCase(fullPath string)
- type TableOutput
- type ZshHelper
Constants ¶
const ( ModusInit = 1 ModusRun = 2 ModusTask = 3 ModusIdle = 4 )
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 )
this file contains important constants for the powershell runner
const ( DefaultSubPath = "/.contxt/shared/" DefaultVersionConf = "version.conf" DefaultExecYaml = string(os.PathSeparator) + ".contxt.yml" )
Variables ¶
var ( WhiteBlue = "" Black = "" Blue = "" Prompt = "" ProgressBar = "" Lc = "" OkSign = "" MesgStartCol = "" MesgErrorCol = "" Yellow = "" CurrentLabelSize = 0 NeededLabelSize = 0 BaseLabelSize = 10 MaxeLabelSize = 40 )
Functions ¶
func AddPathToIncludeImports ¶
func AddPathToIncludeImports(incConfig *configure.IncludePaths, pathToAdd string) (string, error)
AddPathToIncludeImports adds a path to the include section of the .inc.contxt.yml file so it will be read as an value file
func CreateContxtFile ¶
func CreateContxtFile() error
func MainMenu ¶
func MainMenu(tc *ctxtcell.CtCell, c *CmdExecutorImpl)
func MainScreen ¶
func MainScreen(c *CmdExecutorImpl) (*ctxtcell.CtCell, error)
func NewLogrusLogger ¶
func NewLogrusLogger() *logrusLogger
func NewShellInstall ¶
NewShellInstall returns a new shellInstall struct
func TemplateTargetsAsMap ¶
func UserDirectory ¶
Types ¶
type CmdExecutor ¶
type CmdExecutor interface { SetOutputHandlerByName(name string) error // set the output handler by name like table, plain, json Print(msg ...interface{}) Println(msg ...interface{}) PrintPaths(plain bool, showFulltask bool) // print out all paths GetLogger() mimiclog.Logger // get logger GetOuputHandler() (ctxout.StreamInterface, ctxout.PrintInterface) // get output handlers SetLogLevel(level string) error // set log level ResetVariables() // reset old variables while change the workspace. (req for shell mode) MainInit() // initialize the workspace InitExecuter() error // initialize the executer RunTargets(string, bool) error // run targets GetTargets(incInvisible bool) []string // return all targets. optional include invisible targets CallBackNewWs(string) // callback for new workspace CallBackOldWs(string) bool // callback for old workspace FindWorkspaceInfoByTemplate(updateFn func(workspace string, cnt int, update bool, info configure.WorkspaceInfoV2)) (allCount int, updatedCount int) PrintWorkspaces() // print out all workspaces GetWorkspaces() []string // print out all workspaces as a list DirFindApplyAndSave(args []string) (string, error) // find pathbay arguments,save the current path print the path InteractiveScreen() // interactive screen ShellWithComands(cmds []string, timeout int) // interactive screen GetCurrentWorkSpace() string // get current workspace Lint(bool) error // lint the current workspace PrintTemplate() // print out the current template as yaml SetPreValue(name string, value string) // set a pre value PrintVariables(format string) // print out all variables AddIncludePath(path string) error // add a path to the include section CreateContxtFile() error // create a new contxt file RunAnkoScript(args []string) error // run an anko script // contains filtered or unexported methods }
type CmdExecutorImpl ¶
type CmdExecutorImpl struct {
// contains filtered or unexported fields
}
func NewCmd ¶
func NewCmd(session *CmdSession) *CmdExecutorImpl
func (*CmdExecutorImpl) AddIncludePath ¶
func (c *CmdExecutorImpl) AddIncludePath(path string) error
func (*CmdExecutorImpl) CallBackNewWs ¶
func (c *CmdExecutorImpl) CallBackNewWs(newWs string)
func (*CmdExecutorImpl) CallBackOldWs ¶
func (c *CmdExecutorImpl) CallBackOldWs(oldws string) bool
func (*CmdExecutorImpl) Combine4Print ¶
func (c *CmdExecutorImpl) Combine4Print(msg ...interface{}) []interface{}
func (*CmdExecutorImpl) CreateContxtFile ¶
func (c *CmdExecutorImpl) CreateContxtFile() error
func (*CmdExecutorImpl) DecidePath ¶
func (c *CmdExecutorImpl) DecidePath(searchWords, paths []string) (path string, found bool)
func (*CmdExecutorImpl) DirFind ¶
func (c *CmdExecutorImpl) 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 (*CmdExecutorImpl) DirFindApplyAndSave ¶
func (c *CmdExecutorImpl) DirFindApplyAndSave(args []string) (string, error)
func (*CmdExecutorImpl) FindIndexByPath ¶
func (c *CmdExecutorImpl) FindIndexByPath(path string) (index string, ok bool)
func (*CmdExecutorImpl) FindWorkspaceInfoByTemplate ¶
func (c *CmdExecutorImpl) FindWorkspaceInfoByTemplate(updateFn func(workspace string, cnt int, update bool, info configure.WorkspaceInfoV2)) (allCount int, updatedCount int)
func (*CmdExecutorImpl) GetAllOutputHandlerNames ¶
func (c *CmdExecutorImpl) GetAllOutputHandlerNames() []string
func (*CmdExecutorImpl) GetCurrentWorkSpace ¶
func (c *CmdExecutorImpl) GetCurrentWorkSpace() string
func (*CmdExecutorImpl) GetLogger ¶
func (c *CmdExecutorImpl) GetLogger() mimiclog.Logger
func (*CmdExecutorImpl) GetOuputHandler ¶
func (c *CmdExecutorImpl) GetOuputHandler() (ctxout.StreamInterface, ctxout.PrintInterface)
func (*CmdExecutorImpl) GetTargets ¶
func (c *CmdExecutorImpl) GetTargets(incInvisible bool) []string
func (*CmdExecutorImpl) GetVariable ¶
func (c *CmdExecutorImpl) GetVariable(name string) string
func (*CmdExecutorImpl) GetVariables ¶
func (c *CmdExecutorImpl) GetVariables() map[string]string
func (*CmdExecutorImpl) GetWorkspaces ¶
func (c *CmdExecutorImpl) GetWorkspaces() []string
func (*CmdExecutorImpl) InitExecuter ¶
func (c *CmdExecutorImpl) InitExecuter() error
func (*CmdExecutorImpl) InteractiveScreen ¶
func (c *CmdExecutorImpl) InteractiveScreen()
func (*CmdExecutorImpl) Lint ¶
func (c *CmdExecutorImpl) Lint(showAll bool) error
func (*CmdExecutorImpl) MainInit ¶
func (c *CmdExecutorImpl) MainInit()
func (*CmdExecutorImpl) MessageToString ¶
func (c *CmdExecutorImpl) MessageToString(msg ...interface{}) string
func (*CmdExecutorImpl) Print ¶
func (c *CmdExecutorImpl) Print(msg ...interface{})
func (*CmdExecutorImpl) PrintPaths ¶
func (c *CmdExecutorImpl) PrintPaths(plain bool, showFulltask bool)
func (*CmdExecutorImpl) PrintShared ¶
func (c *CmdExecutorImpl) PrintShared()
PrintShared print all shared paths in a simple list
func (*CmdExecutorImpl) PrintTemplate ¶
func (c *CmdExecutorImpl) PrintTemplate()
displays the current version of contxt template as a yaml string
func (*CmdExecutorImpl) PrintVariables ¶
func (c *CmdExecutorImpl) PrintVariables(format string)
func (*CmdExecutorImpl) PrintWorkspaces ¶
func (c *CmdExecutorImpl) PrintWorkspaces()
func (*CmdExecutorImpl) Println ¶
func (c *CmdExecutorImpl) Println(msg ...interface{})
func (*CmdExecutorImpl) ResetVariables ¶
func (c *CmdExecutorImpl) ResetVariables()
func (*CmdExecutorImpl) RunAnkoScript ¶
func (c *CmdExecutorImpl) RunAnkoScript(args []string) error
func (*CmdExecutorImpl) RunTargets ¶
func (c *CmdExecutorImpl) RunTargets(target string, force bool) error
RunTargets run the given targets force is used as flag for the first level targets, and is used to runs shared targets once in front of the regular assigned targets
func (*CmdExecutorImpl) SetColor ¶
func (c *CmdExecutorImpl) SetColor(onoff bool)
func (*CmdExecutorImpl) SetLogLevel ¶
func (c *CmdExecutorImpl) SetLogLevel(level string) error
func (*CmdExecutorImpl) SetOutputHandlerByName ¶
func (c *CmdExecutorImpl) SetOutputHandlerByName(name string) error
func (*CmdExecutorImpl) SetPreValue ¶
func (c *CmdExecutorImpl) SetPreValue(name string, value string)
Set the given variable to the current session Default Variables. this will end up by using them as variables for the template, and are reset for any run. this is also an different Behavior to V1 where the variables are set for the wohle runtime, and if they changed by a task, they are changed for the whole runtime. this is not happen anymore, and the variables are just set for the current run.
func (*CmdExecutorImpl) SetProjectVariables ¶
func (c *CmdExecutorImpl) SetProjectVariables()
SetProjectVariables set the project variables for the current session. what includes any workspaces and there paths. we ignore any errors, since we are not able to do anything with them. this would just be a log entry and ignored as variable.
func (*CmdExecutorImpl) SetStartupVariables ¶
func (c *CmdExecutorImpl) SetStartupVariables(dataHndl *tasks.CombinedDh, template *configure.RunConfig)
set the default runtime variables depeding the predefined variables from the main init, and the given variables depending the task and environment
func (*CmdExecutorImpl) ShellWithComands ¶
func (c *CmdExecutorImpl) ShellWithComands(cmds []string, timeout int)
type CmdSession ¶
type CmdSession struct { Log *SessionLogger // the whole logging stuff TemplateHndl *ctemplate.Template // template handler they execute the template Cobra *SessionCobra // the cobra command handler OutPutHdnl ctxout.StreamInterface // used for output stream Printer ctxout.PrintInterface // used formated printing to the console DefaultVariables map[string]string // DefaultVariables are variables which are set for every task. they are predefines. not the used variables itself }
func NewCmdSession ¶
func NewCmdSession() *CmdSession
type CobraOptions ¶
type CobraOptions struct { ShowColors bool // flag for show colors in output DisableTable bool // flag for disable table output RunOnceTimeOutMillis int // timeout for run once mode ShowHints bool LogLevel string DirAll bool // dir flag for show all dirs in any workspace ShowFullTargets bool ShowBuild bool LastDirIndex bool UseContext string // flag to switch to a workspace in the context of another workspace InContext bool // flag to use the current workspace as context PreVars map[string]string // preset variables they will set variables from commandline. they will be overwritten by the template ShowVars bool // show the variables ShowVarsPattern string // show the variables with a pattern OutputHandler string // set the output handler by name }
type CtxShell ¶
type Fields ¶
type Fields map[string]interface{}
mapping the logrus levels to mimiclog levels
func (Fields) ToLogrusFields ¶
type ImportHandler ¶
type ImportHandler struct {
// contains filtered or unexported fields
}
func NewImportHandler ¶
func NewImportHandler(logger mimiclog.Logger, dataHndl *tasks.CombinedDh, template *ctemplate.Template) *ImportHandler
func (*ImportHandler) HandleImports ¶
func (ih *ImportHandler) HandleImports() error
func (*ImportHandler) SetImports ¶
func (ih *ImportHandler) SetImports(imports []string)
type LogrusMimic ¶
type LogrusMimic struct { }
func (*LogrusMimic) Name ¶
func (l *LogrusMimic) Name() string
type OutputHandler ¶
type OutputHandler interface { GetOutHandler(c *CmdExecutorImpl) func(msg ...interface{}) GetName() string }
type PlainOutput ¶
type PlainOutput struct { }
func NewPlainOutput ¶
func NewPlainOutput() *PlainOutput
func (*PlainOutput) GetName ¶
func (p *PlainOutput) GetName() string
func (*PlainOutput) GetOutHandler ¶
func (p *PlainOutput) GetOutHandler(c *CmdExecutorImpl) func(msg ...interface{})
type RandColor ¶
type RandColor struct {
// contains filtered or unexported fields
}
func PickRandColor ¶
func PickRandColor() RandColor
PickRandColor picks a random color combination from the looksGoodCombinations list
func PickRandColorByIndex ¶
PickRandColorByIndex picks a color combination from the looksGoodCombinations list by the given index if the index is out of range, the first color combination is returned
func (*RandColor) AsSignColor ¶
AsSignColor returns the sign color as ctxout markup
func (*RandColor) ColorMarkup ¶
ColorMarkup returns the color combination as ctxout markup
type RandColorStore ¶
type RandColorStore struct {
// contains filtered or unexported fields
}
func LastRandColorInstance ¶
func LastRandColorInstance() *RandColorStore
LastRandColorInstance returns the last instance of RandColorStore if no instance exists, a new one is created this is a singleton (kind of) the reason is just to have a global instance so you have access to the colors assigned to an task, from everywhere in the code. this logic can fail, of course if you have multiple instances of RandColorStore created.
func NewRandColorStore ¶
func NewRandColorStore() *RandColorStore
NewRandColorStore creates a new RandColorStore and stores the last instance in a global variable
func (*RandColorStore) GetColorAsCtxMarkup ¶
func (rcs *RandColorStore) GetColorAsCtxMarkup(taskName string) (string, string, string)
GetColorAsCtxMarkup returns the color combination for the given taskName as ctxout markup the first return value is the foreground color as markup the second return value is the background color as markup the third return value is the sign color as markup. this simply the foreground color used as background color, so cou can draw a sign with the foreground color.
func (*RandColorStore) GetMaxVariants ¶
func (rcs *RandColorStore) GetMaxVariants() int
GetMaxVariants returns the number of color combinations in the looksGoodCombinations list
func (*RandColorStore) GetOrSetIndexColor ¶
func (rcs *RandColorStore) GetOrSetIndexColor(taskName string) RandColor
GetOrSetIndexColor returns a color combination for the given taskName
func (*RandColorStore) GetOrSetRandomColor ¶
func (rcs *RandColorStore) GetOrSetRandomColor(taskName string) (RandColor, bool)
GetOrSetIndexColor returns a color combination for the given taskName this color is randomly picked from the looksGoodCombinations list if the color is not already in usage, the second return value is false if the color is already in usage, the second return value is true this is also the case,if we ask for a color that is already stored
func (*RandColorStore) IsInusage ¶
func (rcs *RandColorStore) IsInusage(color RandColor) bool
IsInusage returns true if the given color is already in usage
func (*RandColorStore) PickUnusedRandColor ¶
func (rcs *RandColorStore) PickUnusedRandColor() (RandColor, bool)
PickUnusedRandColor picks a random color combination from the looksGoodCombinations list that is not in usage. if all colors are in usage, the first color combination is returned so there is no guarantee that you get an unused color combination. the second return value is true if the color combination is unused the second return value is false if the color combination is in usage
type SessionCobra ¶
type SessionCobra struct { RootCmd *cobra.Command // the root command ExternalCmdHndl CmdExecutor // the command executor that is used to execute the commands logic Options CobraOptions // all flags for the root command }
func NewCobraCmds ¶
func NewCobraCmds() *SessionCobra
this is the main entry point for the cobra command
func (*SessionCobra) GetAnkoRunCmd ¶
func (c *SessionCobra) GetAnkoRunCmd() *cobra.Command
func (*SessionCobra) GetCreateCmd ¶
func (c *SessionCobra) GetCreateCmd() *cobra.Command
func (*SessionCobra) GetCreateImportCmd ¶
func (c *SessionCobra) GetCreateImportCmd() *cobra.Command
func (*SessionCobra) GetDirAddCmd ¶
func (c *SessionCobra) GetDirAddCmd() *cobra.Command
func (*SessionCobra) GetDirCmd ¶
func (c *SessionCobra) GetDirCmd() *cobra.Command
func (*SessionCobra) GetDirFindCmd ¶
func (c *SessionCobra) GetDirFindCmd() *cobra.Command
func (*SessionCobra) GetDirLsCmd ¶
func (c *SessionCobra) GetDirLsCmd() *cobra.Command
GetDirLsCmd returns the command to list all paths in the current workspace
func (*SessionCobra) GetDirRmCmd ¶
func (c *SessionCobra) GetDirRmCmd() *cobra.Command
func (*SessionCobra) GetGotoCmd ¶
func (c *SessionCobra) GetGotoCmd() *cobra.Command
func (*SessionCobra) GetInstallBashCmd ¶
func (c *SessionCobra) GetInstallBashCmd() *cobra.Command
func (*SessionCobra) GetInstallCmd ¶
func (c *SessionCobra) GetInstallCmd() *cobra.Command
func (*SessionCobra) GetInstallFishCmd ¶
func (c *SessionCobra) GetInstallFishCmd() *cobra.Command
func (*SessionCobra) GetInstallPowershellCmd ¶
func (c *SessionCobra) GetInstallPowershellCmd() *cobra.Command
func (*SessionCobra) GetInstallZshBaseFunc ¶
func (c *SessionCobra) GetInstallZshBaseFunc() *cobra.Command
func (*SessionCobra) GetInstallZshCmd ¶
func (c *SessionCobra) GetInstallZshCmd() *cobra.Command
func (*SessionCobra) GetInstallZshShellScript ¶
func (c *SessionCobra) GetInstallZshShellScript() *cobra.Command
func (*SessionCobra) GetInteractiveCmd ¶
func (c *SessionCobra) GetInteractiveCmd() *cobra.Command
func (*SessionCobra) GetInteractiveOnceCmd ¶
func (c *SessionCobra) GetInteractiveOnceCmd() *cobra.Command
func (*SessionCobra) GetLintCmd ¶
func (c *SessionCobra) GetLintCmd() *cobra.Command
func (*SessionCobra) GetLintTemplateCmd ¶
func (c *SessionCobra) GetLintTemplateCmd() *cobra.Command
a lint sub command to display the current loaded template as yaml
func (*SessionCobra) GetListWsCmd ¶
func (c *SessionCobra) GetListWsCmd() *cobra.Command
func (*SessionCobra) GetNewWsCmd ¶
func (c *SessionCobra) GetNewWsCmd() *cobra.Command
func (*SessionCobra) GetPrintWsCmd ¶
func (c *SessionCobra) GetPrintWsCmd() *cobra.Command
func (*SessionCobra) GetRmWsCmd ¶
func (c *SessionCobra) GetRmWsCmd() *cobra.Command
func (*SessionCobra) GetRunAtAllCmd ¶
func (c *SessionCobra) GetRunAtAllCmd() *cobra.Command
func (*SessionCobra) GetRunCmd ¶
func (c *SessionCobra) GetRunCmd() *cobra.Command
func (*SessionCobra) GetScanCmd ¶
func (c *SessionCobra) GetScanCmd() *cobra.Command
func (*SessionCobra) GetVariablesCmd ¶
func (c *SessionCobra) GetVariablesCmd() *cobra.Command
func (*SessionCobra) GetVersionCmd ¶
func (c *SessionCobra) GetVersionCmd() *cobra.Command
func (*SessionCobra) GetWorkspaceCmd ¶
func (c *SessionCobra) GetWorkspaceCmd() *cobra.Command
func (*SessionCobra) Init ¶
func (c *SessionCobra) Init(cmd CmdExecutor) error
init the cobra command tree
func (*SessionCobra) PrintCurrentWs ¶
func (c *SessionCobra) PrintCurrentWs() *cobra.Command
prints the current workspace
type SessionLogger ¶
type SharedHelper ¶
type SharedHelper struct {
// contains filtered or unexported fields
}
SharedHelper is a helper to handle shared content that is hosted on github
func NewSharedHelper ¶
func NewSharedHelper() *SharedHelper
NewSharedHelper returns a new instance of the SharedHelper depending on the user home dir
func NewSharedHelperWithPath ¶
func NewSharedHelperWithPath(basePath string) *SharedHelper
NewSharedHelperWithPath returns a new instance of the SharedHelper depending on the given path
func (*SharedHelper) CheckOrCreateUseConfig ¶
func (sh *SharedHelper) 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 (*SharedHelper) GetBasePath ¶
func (sh *SharedHelper) GetBasePath() string
GetBasePath returns the base path of the shared folder
func (*SharedHelper) GetSharedPath ¶
func (sh *SharedHelper) GetSharedPath(sharedName string) string
GetSharedPath returns the full path of the given shared name
func (*SharedHelper) GetSharedPathForUseCase ¶
func (sh *SharedHelper) GetSharedPathForUseCase(usecase string) string
func (*SharedHelper) GetUseInfo ¶
func (sh *SharedHelper) GetUseInfo(usecase, _ string) (string, string)
GetUseInfo returns the usecase and the version from the given usecase-string
func (*SharedHelper) HandleUsecase ¶
func (sh *SharedHelper) HandleUsecase(externalUseCase string) string
func (*SharedHelper) ListUseCases ¶
func (sh *SharedHelper) ListUseCases(fullPath bool) ([]string, error)
ListUseCases returns a list of all available shared usecases
func (*SharedHelper) MergeRequiredPaths ¶
func (sh *SharedHelper) MergeRequiredPaths(ctemplate *configure.RunConfig, templateHandler *ctemplate.Template) error
Merged the required paths into the given template. this is loading the .contxt.yml from the required path, located in the shared folder and merges them into the given template. so the current template will be extended by the content of these files.
func (*SharedHelper) SetLogger ¶
func (sh *SharedHelper) SetLogger(logger mimiclog.Logger)
SetLogger sets the logger for the shared helper. the default is a null logger
func (*SharedHelper) StripContxtUseDir ¶
func (sh *SharedHelper) StripContxtUseDir(path string) string
func (*SharedHelper) UpdateUseCase ¶
func (sh *SharedHelper) UpdateUseCase(fullPath string)
type TableOutput ¶
type TableOutput struct {
// contains filtered or unexported fields
}
func NewTableOutput ¶
func NewTableOutput() *TableOutput
func (*TableOutput) GetName ¶
func (t *TableOutput) GetName() string
func (*TableOutput) GetOutHandler ¶
func (t *TableOutput) GetOutHandler(c *CmdExecutorImpl) func(msg ...interface{})
type ZshHelper ¶
type ZshHelper struct {
// contains filtered or unexported fields
}
the zsh helper is used to find the zsh binary and the fpath for the zsh completion files.
func (*ZshHelper) GetBinPath ¶
get the zsh binary path or an error
func (*ZshHelper) GetFirstExistingPath ¶
func (*ZshHelper) GetFirstFPath ¶
get the first usable fpath or an error
func (*ZshHelper) GetFpathByEnv ¶
try to read the fpath from the env. variable FPATH this is not the way that should work in real, but so we can test it. also it can be used to force the fpath.