utils

package
v0.10.2 Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Copy

func Copy(fs afero.Fs, src, dst string) error

Copy copies a file from source to a destination

func CopyFS added in v0.10.1

func CopyFS(dir string, fsys fs.FS) error

TODO: replace once go-1.23 is released

func IsCommandPresent added in v0.9.0

func IsCommandPresent(command string) bool

func IsEmpty

func IsEmpty(name string) (bool, error)

IsEmpty returns whether a directory is empty or not

func RemoveContents

func RemoveContents(dir string) error

RemoveContents removes all files from a directory, but not the directory itself

Types

type CmdExecutor

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

func NewExecutor

func NewExecutor(log *slog.Logger) *CmdExecutor

func (*CmdExecutor) ExecWithStreamingOutput added in v0.8.0

func (c *CmdExecutor) ExecWithStreamingOutput(ctx context.Context, command string) error

func (*CmdExecutor) ExecuteCommandWithOutput

func (c *CmdExecutor) ExecuteCommandWithOutput(ctx context.Context, command string, env []string, arg ...string) (string, error)

type TablePrinter

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

TablePrinter can be used to print data as a table

func NewTablePrinter

func NewTablePrinter() *TablePrinter

NewTablePrinter returns a new table printer

func (*TablePrinter) Print

func (t *TablePrinter) Print(headers []string, data [][]string)

Print prints the table

Jump to

Keyboard shortcuts

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