file

package
v0.25.0 Latest Latest
Warning

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

Go to latest
Published: Feb 16, 2026 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package file provides file manipulation and processing utilities.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FromPath

func FromPath(path, pattern string) ([]string, error)

FromPath from a file or dir path returns an array of flat file paths. pattern is a filepath.Match pattern to limit files to a pattern

func ToObjects

func ToObjects(paths []string) ([]client.Object, error)

ToObjects from a list of paths, returns an array of runtime objects.

func TrimExt

func TrimExt(path string) string

TrimExt removes the ext of a file path, foo.tar == foo

func UnTar

func UnTar(dest string, r io.Reader, compressed bool) (err error)

UnTar untars a tar or tgz file into the dest folder. dest is the folder location io.Reader is a reader that is tar (or compressed tar) format compressed is true if reader is a compressed format

func UntarInPlace

func UntarInPlace(path string) error

UntarInPlace untars a .tar file using the same name as the file as the sub-folder name in the folder it was referenced in. i.e., /opt/foo.tar will land in /opt/foo supports tar and tgz file formats

Types

type Info

type Info struct {
	Type Type
	// Error is set for TypeUnknown objects and describes the reason.
	Error    error
	BaseName string
	FullName string
	// HasIndex is true when the file name starts with a valid index.
	HasIndex   bool
	Index      int64
	StepName   string
	IsTemplate bool
}

Info contains parsed information about a test file name.

func Parse

func Parse(fullName string) Info

Parse parses a file name and returns information about its type and structure.

type Type

type Type int

Type represents the type of a test file.

const (
	// TypeUnknown means it was not possible to determine the type of file, e.g. unrecognized name pattern.
	TypeUnknown Type = iota
	// TypeApply denotes files with resources to apply on the cluster.
	TypeApply
	// TypeAssert denotes assertion files. Must match for the step to pass.
	TypeAssert
	// TypeError denotes negative assertion files. Must not match for the step to pass.
	TypeError
)

Jump to

Keyboard shortcuts

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