utils

package
v1.0.8 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2024 License: MPL-2.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var TemplateFuncs = map[string]interface{}{
	"default": dfault,
	"quote":   quote,
}

Functions

func CheckIfGitRepo

func CheckIfGitRepo(path string, shouldWarn bool) bool

CheckIfGitRepo - runs git diff on the secrets folder - checks path for a .git folder and returns true if found

func CheckIfPrefix

func CheckIfPrefix(input string) bool

CheckIfPrefix returns true of input string ends with a / or *

func CompareStrings

func CompareStrings(str1, str2 string, print bool) (bool, error)

func DownloadSecret

func DownloadSecret(secretID string, secretString string, secretsPath string, delimiter string) error

DownloadSecret - Creates the directory path using the secrets name and the delimiter set ususally to /, then writes the secret the final file

func EnsurePath

func EnsurePath(path string) error

EnsurePath - prints directory path to secrets folder and will create the path if it does not exist

func FormatPrefixString

func FormatPrefixString(prefix string) string

FormatPrefixString returns string with /* as the last two characters

func GitCheckForUpdate

func GitCheckForUpdate(tc *http.Client, parentCtx context.Context, currentVersion string) (*semver.Version, error)

GitCheckForUpdate returns an error and a semver containing the updated tag if it exists

func GitControlSecrets

func GitControlSecrets(secretIDs []string, secretsPath string) error

GitControlSecrets - creates a local git repo and commits the initially downloaded secrets

func GitDiff

func GitDiff(secretsPath string) error

GitDiff - Replace me with golang version

func GitLatestRelease

func GitLatestRelease(currentVersion, token string) error

GitLatestRelease downloads the latest version of jaws if there is a newer version

func GitStatus

func GitStatus(path string) error

GitStatus - runs git status on the secrets folder - Replace me with golang version

func OpenWithEditor

func OpenWithEditor(files []string, path string) error

OpenWithEditor will open a list of files with whatever the env var EDITIOR is set to

func PullSecretNames

func PullSecretNames(secretsPath string) ([]string, error)

PullSecretNames walks the secretsPath and creates a list of secrets that are in there. Returns a list of local secrets and an error

func PushPostRun

func PushPostRun(secretsPath string, cleanLocalSecrets bool) error

PushPostRun - Cleans the secrets folder after Pushing them

func RunCommand

func RunCommand(interpreter string, args []string) (string, error)

RunCommand takes an interpreter with a list of arguments and runs the command returning the output as a string and an error

func ShowFile

func ShowFile(file string) error

ShowFile will displays the contents of file

func Untar

func Untar(dst string, r io.Reader) error

Untar takes a destination path and a reader; a tar reader loops over the tarfile creating the file structure at 'dst' along the way, and writing any files

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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