scripts

package
v0.0.0-...-d57715f Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2024 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ShellPath = "/usr/bin/env bash"
)

Variables

View Source
var (
	AppName    = "dbpaas"
	AppVersion = "0.0.1"
)

Functions

func GetVarsFromTemplate

func GetVarsFromTemplate(tmpl string) []string

Gets a list of all variables mentioned in a template

func SafeTemplateFill

func SafeTemplateFill(tmpl string, data map[string]interface{}) (string, error)

SafeTemplateFill passed template string is formatted using its operands and returns the resulting string. It checks that the data was safely initialized

func TrimmedLines

func TrimmedLines(s string) string

Given a multi-line string, this function removes leading spaces from every line. It also removes the first line, if it is empty

Types

type ScriptDef

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

func NewScriptDef

func NewScriptDef(tmplDesc TemplateDesc, tmplName string, data map[string]interface{}) (scriptDef *ScriptDef, err error)

func (*ScriptDef) GetScriptText

func (s *ScriptDef) GetScriptText() (scriptText string, err error)

type TemplateCollection

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

func NewTemplateCollection

func NewTemplateCollection(tds map[string]TemplateDesc) *TemplateCollection

func (*TemplateCollection) GetScriptText

func (t *TemplateCollection) GetScriptText(key string, data map[string]interface{}) (scriptText string, err error)

func (*TemplateCollection) GetTmpl

func (t *TemplateCollection) GetTmpl(key string) TemplateDesc

type TemplateDesc

type TemplateDesc struct {
	Description string
	Notes       string
	Contents    string
	Executable  bool
}

Jump to

Keyboard shortcuts

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