utils

package
v0.0.0-...-a9e21f0 Latest Latest
Warning

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

Go to latest
Published: Feb 10, 2025 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Contains

func Contains[T comparable](s []T, e T) bool

func FindMatches

func FindMatches(pattern string, text []byte) map[string]interface{}

FindMatches finds regular expression matches in a key/value based text (ini files, for example), and returns a map with them. If the matched key has spaces, they will be replaced with underscores If the same keys is found multiple times, the entry of the map will have a list as value with all of the matched values The pattern must have 2 groups. For example: `(.+)=(.*)`

Types

type CommandExecutor

type CommandExecutor interface {
	Exec(name string, arg ...string) ([]byte, error)
	ExecContext(ctx context.Context, name string, arg ...string) ([]byte, error)
}

type Executor

type Executor struct{}

func (Executor) Exec

func (e Executor) Exec(name string, arg ...string) ([]byte, error)

func (Executor) ExecContext

func (e Executor) ExecContext(ctx context.Context, name string, arg ...string) ([]byte, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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