runner

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: 34 Imported by: 0

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

View Source
const (
	ModusInit = 1
	ModusRun  = 2
	ModusTask = 3
	ModusIdle = 4
)
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
)

this file contains important constants for the powershell runner

View Source
const (
	DefaultSubPath     = "/.contxt/shared/"
	DefaultVersionConf = "version.conf"
	DefaultExecYaml    = string(os.PathSeparator) + ".contxt.yml"
)

Variables

View Source
var (
	WhiteBlue    = ""
	Black        = ""
	Blue         = ""
	Prompt       = ""
	ProgressBar  = ""
	Lc           = ""
	OkSign       = ""
	MesgStartCol = ""
	MesgErrorCol = ""
	Yellow       = ""

	CurrentLabelSize = 0
	NeededLabelSize  = 0
	BaseLabelSize    = 10
	MaxeLabelSize    = 40
)

Functions

func Init

func Init() error

Init initializes the application and starts the main loop

func MainMenu(tc *ctxtcell.CtCell, c *CmdExecutorImpl)

func MainScreen

func MainScreen(c *CmdExecutorImpl) (*ctxtcell.CtCell, error)

func NewLogrusLogger

func NewLogrusLogger() *logrusLogger

func NewShellInstall

func NewShellInstall(logger mimiclog.Logger) *shellInstall

NewShellInstall returns a new shellInstall struct

func TemplateTargetsAsMap

func TemplateTargetsAsMap(template configure.RunConfig, showInvTarget bool) ([]string, bool)

func UserDirectory

func UserDirectory() (string, error)

Types

type CmdExecutor

type CmdExecutor interface {
	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

	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
	PrintShared()                                      // print out all shared libs
	PrintTemplate()                                    // print out the current template as yaml
	SetPreValue(name string, value string)             // set a pre value
	// contains filtered or unexported methods
}

type CmdExecutorImpl

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

func NewCmd

func NewCmd(session *CmdSession) *CmdExecutorImpl

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) 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) GetCurrentWorkSpace

func (c *CmdExecutorImpl) GetCurrentWorkSpace() string

func (*CmdExecutorImpl) GetLogger

func (c *CmdExecutorImpl) GetLogger() mimiclog.Logger

func (*CmdExecutorImpl) GetOuputHandler

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) 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) PrintWorkspaces

func (c *CmdExecutorImpl) PrintWorkspaces()

func (*CmdExecutorImpl) Println

func (c *CmdExecutorImpl) Println(msg ...interface{})

func (*CmdExecutorImpl) ResetVariables

func (c *CmdExecutorImpl) ResetVariables()

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) 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) 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
	SharedHelper     *SharedHelper          // SharedHelper is responsible for the shared tasks.
}

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
}

type CtxShell

type CtxShell struct {
	Modus          int
	MaxTasks       int
	CollectedTasks []string
	SynMutex       sync.Mutex
	LabelForeColor string
	LabelBackColor string
	// contains filtered or unexported fields
}

func (*CtxShell) PromtDraw

func (cs *CtxShell) PromtDraw(reason int, label string) string

returns the prompt for linux.

type Fields

type Fields map[string]interface{}

mapping the logrus levels to mimiclog levels

func (Fields) ToLogrusFields

func (f Fields) ToLogrusFields() logrus.Fields

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) Init

func (l *LogrusMimic) Init(args ...interface{}) (mimiclog.Logger, error)

func (*LogrusMimic) Name

func (l *LogrusMimic) Name() string

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

func PickRandColorByIndex(index int) RandColor

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

func (r *RandColor) AsSignColor() string

AsSignColor returns the sign color as ctxout markup

func (*RandColor) BackColor

func (r *RandColor) BackColor() string

BackColor returns the background color as ctxout markup

func (*RandColor) ColorMarkup

func (r *RandColor) ColorMarkup() string

ColorMarkup returns the color combination as ctxout markup

func (*RandColor) ForeColor

func (r *RandColor) ForeColor() string

ForeColor returns the foreground color 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) 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) GetRunCmd

func (c *SessionCobra) GetRunCmd() *cobra.Command

func (*SessionCobra) GetScanCmd

func (c *SessionCobra) GetScanCmd() *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 SessionLogger struct {
	LogLevel string
	Logger   mimiclog.Logger
}

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 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 NewZshHelper

func NewZshHelper() *ZshHelper

create a new zsh helper

func (*ZshHelper) GetBinPath

func (z *ZshHelper) GetBinPath() (string, error)

get the zsh binary path or an error

func (*ZshHelper) GetFPaths

func (z *ZshHelper) GetFPaths() ([]string, error)

get all the fpaths they are usable (writeable) or an error

func (*ZshHelper) GetFirstExistingPath

func (z *ZshHelper) GetFirstExistingPath() (string, error)

func (*ZshHelper) GetFirstFPath

func (z *ZshHelper) GetFirstFPath() (string, error)

get the first usable fpath or an error

func (*ZshHelper) GetFpathByEnv

func (z *ZshHelper) GetFpathByEnv() (string, error)

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.

Directories

Path Synopsis
example

Jump to

Keyboard shortcuts

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