cmdsubst

package
v0.0.0-...-87586f8 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const SecretOrRandomPasswordCommandName string = "secretOrRandomPassword"

Variables

This section is empty.

Functions

func ContainsCommandInvocation

func ContainsCommandInvocation(doc, commandName string) bool

Returns true if the document 'doc' contains an invocation of a command.

func Eval

func Eval(ctx context.Context, input string, cmd CommandExecutor) (string, error)

Eval replaces all occurrences of bash-like command output substitution $(command arg1 arg2 ...) with the result provided by the command executor. Any error from the command executor will result in an error reported from Eval().

Types

type CommandExecutor

type CommandExecutor interface {
	// Returns true + replacement string if a command is recognized and runs successfully.
	// Returns false and no error if the command was not recognized by the executor, or in other "no-op" cases.
	Run(ctx context.Context, commandName string, args []string) (bool, string, error)
}

type SecretOrRandomPasswordCommandExecutor

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

func NewSecretOrRandomPasswordExecutor

func NewSecretOrRandomPasswordExecutor(
	keyvaultService keyvault.KeyVaultService, subscriptionId string) *SecretOrRandomPasswordCommandExecutor

func (*SecretOrRandomPasswordCommandExecutor) Run

func (e *SecretOrRandomPasswordCommandExecutor) Run(
	ctx context.Context,
	commandName string,
	args []string,
) (bool, string, error)

Jump to

Keyboard shortcuts

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