templateutils

package
v0.4.3 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2021 License: Apache-2.0 Imports: 28 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddPrefix

func AddPrefix(s, prefix, sep string) string

AddPrefix to each separated string elements

func AddSuffix

func AddSuffix(s, suffix, sep string) string

AddSuffix to each separated string elements

func CreateEmbeddedShellRunner

func CreateEmbeddedShellRunner(
	workingDir string,
	rc dukkha.RenderingContext,
	stdin io.Reader,
	stdout io.Writer,
	stderr io.Writer,
) (*interp.Runner, error)

func CreateTemplate

func CreateTemplate(rc dukkha.RenderingContext) *template.Template

func ExecCmdAsTemplateFuncCall

func ExecCmdAsTemplateFuncCall(
	rc dukkha.RenderingContext,
	stdin io.Reader,
	stdout io.Writer,
	args []string,
) error

func ExpandEnv added in v0.4.3

func ExpandEnv(rc dukkha.RenderingContext, toExpand string) (string, error)

func GenerateTOTPCode added in v0.4.0

func GenerateTOTPCode(token string, t time.Time, codeLength int) (string, error)

MIT License

Copyright (c)

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.

Copied from https://github.com/yitsushi/totp-cli/blob/main/internal/security/otp.go with modification to codeLength

func GetDefaultImageTag added in v0.2.0

func GetDefaultImageTag(
	rc dukkha.RenderingContext, imageName string, keepKernelInfo bool,
) string

func GetDefaultManifestTag added in v0.2.0

func GetDefaultManifestTag(
	rc dukkha.RenderingContext, manifestName string,
) string

func GetDefaultTag added in v0.2.0

func GetDefaultTag(
	rc dukkha.RenderingContext,
	name string,
	isManifest bool,
	keepKernelInfo bool,
) string

func RegisterTemplateFuncs

func RegisterTemplateFuncs(fm map[string]TemplateFuncFactory)

func RemovePrefix

func RemovePrefix(s, prefix, sep string) string

RemovePrefix of each separated string elements

func RemoveSuffix

func RemoveSuffix(s, suffix, sep string) string

func RunScriptInEmbeddedShell

func RunScriptInEmbeddedShell(
	ctx context.Context,
	runner *interp.Runner,
	parser *syntax.Parser,
	script string,
) error

func SetDefaultImageTagIfNoTagSet

func SetDefaultImageTagIfNoTagSet(
	rc dukkha.RenderingContext, imageName string, keepKernelInfo bool,
) string

func SetDefaultManifestTagIfNoTagSet

func SetDefaultManifestTagIfNoTagSet(
	rc dukkha.RenderingContext, manifestName string,
) string

Types

type TemplateFuncFactory

type TemplateFuncFactory func(rc dukkha.RenderingContext) interface{}

Jump to

Keyboard shortcuts

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