Documentation
¶
Index ¶
- Constants
- Variables
- func CheckCurrentVersion(askWithVersion string) bool
- func CheckVersion(askWithVersion string, verifyAgainst string) bool
- func GetBinaryName() string
- func GetBuild() string
- func GetCnShortcut() string
- func GetGlobalConfig() *contxtConfigure
- func GetOs() string
- func GetShortcut() string
- func GetShortcutsAndBinaryName() (string, string, string)
- func GetVersion() string
- func NewCfgV2(c *contxtConfigure)
- func NewContxtConfig() *contxtConfigure
- func SetBinaryName(newBinaryName string)
- func SetCnShortcut(newShortcut string)
- func SetShortcut(newShortcut string)
- func SetVersion(main, mid, min string)
- type Action
- type Autorun
- type CommandLine
- type Config
- type ConfigMetaV2
- type Configuration
- type ConfigurationV2
- type ExecuteDefinition
- type GetPathCallback
- type GitVersionInfo
- type IncludePaths
- type Listener
- type Options
- type Require
- type RequireCheck
- type RunConfig
- type Task
- type Trigger
- type VarMaps
- type WorkspaceInfo
- type WorkspaceInfoV2
Constants ¶
const ( // DefaultConfigFileName is the main config json file name. DefaultConfigFileName = "contxt_current_config.json" // DefaultPath this is the default path to store gocd configurations DefaultPath = "/.contxt/" // DefaultWorkspace this is the main configuration workspace DefaultWorkspace = "default_contxt_ws" // MirrorPath path for local mirror MirrorPath = "mirror/" Sharedpath = "shared/" )
Variables ¶
var ( USE_SPECIAL_DIR = true // if true, we will use some of the special dirs like user home or other. defined in the config model CONTEXT_DIR = "contxt" // default directory name for the config files CONTXT_FILE = "contxtv2.yml" // default file name for the config file CFG ConfigMetaV2 = ConfigMetaV2{} // the config model MIGRATION_ENABLED = true // if true, we will try to migrate from v1 to v2 CONFIG_PATH_CALLBACK GetPathCallback = nil // if set, we will use this callback to get the absolte path to the config file )
Functions ¶
func CheckCurrentVersion ¶
CheckCurrentVersion checks if the current version is greater or equal to the given version
func CheckVersion ¶
CheckVersion checks if the given version is greater or equal to the verifyAgainst version
func GetBinaryName ¶
func GetBinaryName() string
GetBinaryName delivers the current binary name if no binary name is set, the default is "contxt"
func GetCnShortcut ¶
func GetCnShortcut() string
GetCnShortcut delivers the current shortcut for the context cn command in bash, fish, zsh and powershell if no shortcut is set, the default is "cn"
func GetGlobalConfig ¶
func GetGlobalConfig() *contxtConfigure
func GetOs ¶
func GetOs() string
GetOs returns the current operating system if no operating system is set, the default is the runtime.GOOS
func GetShortcut ¶
func GetShortcut() string
GetShortcut delivers the current shortcut for the context functions in bash, fish, zsh and powershell if no shortcut is set, the default is "ctx"
func GetShortcutsAndBinaryName ¶
GetShortcutsAndBinaryName delivers the current shortcuts and binary name for the context functions in bash, fish, zsh and powershell this is the contxt shortcut, then cn shortcut and the binary name
func NewContxtConfig ¶
func NewContxtConfig() *contxtConfigure
func SetBinaryName ¶
func SetBinaryName(newBinaryName string)
func SetCnShortcut ¶
func SetCnShortcut(newShortcut string)
func SetVersion ¶
func SetVersion(main, mid, min string)
Types ¶
type Action ¶
type Action struct { Target string `yaml:"target"` Stopall bool `yaml:"stopall"` Script []string `yaml:"script"` }
Action defines what should happens Next.
type Autorun ¶
type Autorun struct { // this target will be executed if to this workspace was changed Onenter string `yaml:"onenter"` // this target will be executed if we changing to another workspace // so we leaving the current workspace // can be used for cleanup ...as a example Onleave string `yaml:"onleave"` }
Autorun defines the targets they have to be executed if a special event is triggered
type CommandLine ¶
type CommandLine struct { Require RequireCheck Command string Params string Comment string StopOnError bool StopOnOutCountLess int StopOnOutCountMore int StopOnOutContains string TraceOutput bool }
CommandLine defines a line of commands that can be executed
type Config ¶
type Config struct { Sequencially bool `yaml:"sequencially"` Coloroff bool `yaml:"coloroff"` Loglevel string `yaml:"loglevel"` Variables map[string]string `yaml:"variables,omitempty"` Autorun Autorun `yaml:"autorun"` Imports []string `yaml:"imports"` Use []string `yaml:"use"` Require []string `yaml:"require"` MergeTasks bool `yaml:"mergetasks"` AllowMutliRun bool `yaml:"allowmultiplerun"` }
Config is the main Configuration part of the Template.
type ConfigMetaV2 ¶
type ConfigMetaV2 struct { CurrentSet string `yaml:"CurrentSet"` Configs map[string]ConfigurationV2 `yaml:"Configs"` }
new version of the configuration starts here
type Configuration ¶
type Configuration struct { CurrentSet string Paths []string LastIndex int PathInfo map[string]WorkspaceInfo }
Configuration includes all paths for the current workspace this is the main Configuration that is needed to eep track which path is currently used. this is the used format til version 0.4.0
type ConfigurationV2 ¶
type ConfigurationV2 struct { Name string `yaml:"Name"` // the name of the workspace CurrentIndex string `yaml:"CurrentIndex"` // what of the workspaces are the current used Paths map[string]WorkspaceInfoV2 `yaml:"Paths"` }
type ExecuteDefinition ¶
type ExecuteDefinition struct { TestScript []CommandLine InitScript []CommandLine CleanScript []CommandLine Script []CommandLine }
ExecuteDefinition Defines the structure of a .execute file that defines commands they have to executed
type GetPathCallback ¶
type GetPathCallback func() string
type GitVersionInfo ¶
type IncludePaths ¶
type IncludePaths struct { Include struct { Basedir bool `yaml:"basedir"` Folders []string `yaml:"folders"` KeyedFolders []VarMaps `yaml:"keyedFolders"` } `yaml:"include"` }
IncludePaths are files the defines how variables should be parsed. they indludes folders they have to be parsed first so they contents can be sued to proceeed with test/template. otherwise the yaml file is not readable
type Options ¶
type Options struct { IgnoreCmdError bool `yaml:"ignoreCmdError"` Format string `yaml:"format"` Stickcursor bool `yaml:"stickcursor"` Colorcode string `yaml:"colorcode"` Bgcolorcode string `yaml:"bgcolorcode"` Panelsize int `yaml:"panelsize"` Displaycmd bool `yaml:"displaycmd"` Hideout bool `yaml:"hideout"` Invisible bool `yaml:"invisible"` Maincmd string `yaml:"maincmd"` Mainparams []string `yaml:"mainparams"` NoAutoRunNeeds bool `yaml:"noAutoRunNeeds"` TimeoutNeeds int `yaml:"timeoutNeeds"` CmdTimeout int `yaml:"cmdTimeout"` // timeout for the anko commands in milliseconds TickTimeNeeds int `yaml:"tickTimeNeeds"` WorkingDir string `yaml:"workingdir"` }
Options are the per-task options
type Require ¶
type Require struct { Exists []string `yaml:"exists"` NotExists []string `yaml:"notExists"` Environment map[string]string `yaml:"environment,omitempty"` Variables map[string]string `yaml:"variables,omitempty"` System string `yaml:"system,omitempty"` }
Require defines what is required to execute the task
type RequireCheck ¶
RequireCheck defines some variables they have to be valid before script runs
type RunConfig ¶
type RunConfig struct { Version string `yaml:"version"` Config Config `yaml:"config"` Task []Task `yaml:"task"` Workspace WorkspaceInfo `yaml:"workspace,omitempty"` }
RunConfig defines the structure of the local stored execution files this is the ROOT of the contxt.yml
type Task ¶
type Task struct { ID string `yaml:"id"` Variables map[string]string `yaml:"variables,omitempty"` Requires Require `yaml:"require"` Stopreasons Trigger `yaml:"stopreasons"` Options Options `yaml:"options"` Cmd []string `yaml:"cmd"` Script []string `yaml:"script"` Listener []Listener `yaml:"listener"` Next []string `yaml:"next"` RunTargets []string `yaml:"runTargets"` Needs []string `yaml:"needs"` }
Task is the main Script
type Trigger ¶
type Trigger struct { Onerror bool `yaml:"onerror"` OnoutcountLess int `yaml:"onoutcountLess"` OnoutcountMore int `yaml:"onoutcountMore"` OnoutContains []string `yaml:"onoutContains"` Now bool `yaml:"now"` }
Trigger are part of listener. The defines some events they are triggered by executing scripts most of them watching the output
type VarMaps ¶
Reading files and folders and assign the values from them to the variables in the template named by the keyname