os

package
v0.0.0-...-54413df Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2024 License: Apache-2.0 Imports: 12 Imported by: 9

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CommandExecutor

type CommandExecutor interface {
	Execute(cmd string, arg, env []string, dir string) ([]byte, []byte, error)
	ExecuteContext(ctx context.Context, cmd string, arg, env []string, dir string) ([]byte, []byte, error)
}

type EnvProvider

type EnvProvider interface {
	Getenv(key string) string
	GetOS() string
}

type IOStreamsProvider

type IOStreamsProvider interface {
	Stderr() io.Writer
	Stdin() io.Reader
	Stdout() io.Writer
}

type OsExecutor

type OsExecutor interface {
	AppendToFile(path string, data []byte, perm os.FileMode) error
	Args() []string
	Chdir(dir string) error
	Chmod(name string, mode os.FileMode) error
	CopyDir(src, dst string) error
	CopyFile(src, dst string) error
	CopyLink(src, dst string) error
	Create(name string) (*os.File, error)
	CurrentUser() (*user.User, error)
	ExecuteWithStreams(cmd string, arg, env []string, dir string, stdout, stderr io.Writer) error
	ExecuteWithStreamsContext(ctx context.Context, cmd string, arg, env []string, dir string, stdout, stderr io.Writer) error
	Exit(statusCode int)
	ExpandTilde(path string) (string, error)
	Getenv(key string) string
	Setenv(key, value string) error
	GetOS() string
	Getwd() (string, error)
	UserHomeDir() (string, error)
	IsDir(path string) error
	IsExist(err error) bool
	IsFile(path string) error
	IsNotExist(err error) bool
	Lstat(name string) (os.FileInfo, error)
	Mkdir(dirname string, perm os.FileMode) error
	MkdirAll(dirname string, perm os.FileMode) error
	Open(name string) (*os.File, error)
	OpenFile(path string, flag int, perm os.FileMode) (*os.File, error)
	ReadDir(dirname string) ([]os.FileInfo, error)
	ReadFile(filename string) ([]byte, error)
	Readlink(name string) (string, error)
	Remove(path string) error
	RemoveAll(path string) error
	RemoveContents(path string, limit int) error
	Rename(oldPath, newPath string) error
	ResolvePath(path string) (string, error)
	SetStderr(v io.Writer)
	SetStdin(v io.Reader)
	SetStdout(v io.Writer)
	Stat(filepath string) (os.FileInfo, error)
	Stderr() io.Writer
	Stdin() io.Reader
	Stdout() io.Writer
	Symlink(oldname, newname string) error
	TempDir(dir, prefix string) (string, error)
	TempFile(dir, pattern string) (*os.File, error)
	WriteFile(path string, data []byte, perm os.FileMode) error
	CommandExecutor
}

type RealOsExecutor

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

func (*RealOsExecutor) AppendToFile

func (ex *RealOsExecutor) AppendToFile(path string, data []byte, perm os.FileMode) error

func (*RealOsExecutor) Args

func (ex *RealOsExecutor) Args() []string

func (*RealOsExecutor) Chdir

func (ex *RealOsExecutor) Chdir(dir string) error

func (*RealOsExecutor) Chmod

func (ex *RealOsExecutor) Chmod(name string, mode os.FileMode) error

func (*RealOsExecutor) CopyDir

func (ex *RealOsExecutor) CopyDir(src, dst string) error

func (*RealOsExecutor) CopyFile

func (ex *RealOsExecutor) CopyFile(src, dst string) error
func (ex *RealOsExecutor) CopyLink(src, dst string) error

func (*RealOsExecutor) Create

func (ex *RealOsExecutor) Create(name string) (*os.File, error)

func (*RealOsExecutor) CurrentUser

func (ex *RealOsExecutor) CurrentUser() (*user.User, error)

func (*RealOsExecutor) Execute

func (ex *RealOsExecutor) Execute(
	cmd string,
	arg,
	env []string,
	dir string,
) ([]byte, []byte, error)

func (*RealOsExecutor) ExecuteContext

func (ex *RealOsExecutor) ExecuteContext(
	ctx context.Context,
	cmd string,
	arg,
	env []string,
	dir string,
) ([]byte, []byte, error)

func (*RealOsExecutor) ExecuteWithStreams

func (ex *RealOsExecutor) ExecuteWithStreams(
	cmd string,
	arg,
	env []string,
	dir string,
	stdout io.Writer,
	stderr io.Writer,
) error

func (*RealOsExecutor) ExecuteWithStreamsContext

func (ex *RealOsExecutor) ExecuteWithStreamsContext(
	ctx context.Context,
	cmd string,
	arg,
	env []string,
	dir string,
	stdout io.Writer,
	stderr io.Writer,
) error

func (*RealOsExecutor) Exit

func (ex *RealOsExecutor) Exit(statusCode int)

func (*RealOsExecutor) ExpandTilde

func (ex *RealOsExecutor) ExpandTilde(path string) (string, error)

func (*RealOsExecutor) GetOS

func (ex *RealOsExecutor) GetOS() string

func (*RealOsExecutor) Getenv

func (ex *RealOsExecutor) Getenv(key string) string

func (*RealOsExecutor) Getwd

func (ex *RealOsExecutor) Getwd() (string, error)

func (*RealOsExecutor) IsDir

func (ex *RealOsExecutor) IsDir(path string) error

func (*RealOsExecutor) IsExist

func (ex *RealOsExecutor) IsExist(err error) bool

func (*RealOsExecutor) IsFile

func (ex *RealOsExecutor) IsFile(path string) error

func (*RealOsExecutor) IsNotExist

func (ex *RealOsExecutor) IsNotExist(err error) bool

func (*RealOsExecutor) Lstat

func (ex *RealOsExecutor) Lstat(name string) (os.FileInfo, error)

func (*RealOsExecutor) Mkdir

func (ex *RealOsExecutor) Mkdir(dirname string, perm os.FileMode) error

func (*RealOsExecutor) MkdirAll

func (ex *RealOsExecutor) MkdirAll(path string, perm os.FileMode) error

func (*RealOsExecutor) Open

func (ex *RealOsExecutor) Open(name string) (*os.File, error)

func (*RealOsExecutor) OpenFile

func (ex *RealOsExecutor) OpenFile(path string, flag int, perm os.FileMode) (*os.File, error)

func (*RealOsExecutor) ReadDir

func (ex *RealOsExecutor) ReadDir(dirname string) ([]os.FileInfo, error)

func (*RealOsExecutor) ReadFile

func (ex *RealOsExecutor) ReadFile(filename string) ([]byte, error)
func (ex *RealOsExecutor) Readlink(name string) (string, error)

func (*RealOsExecutor) Remove

func (ex *RealOsExecutor) Remove(path string) error

func (*RealOsExecutor) RemoveAll

func (ex *RealOsExecutor) RemoveAll(path string) error

func (*RealOsExecutor) RemoveContents

func (ex *RealOsExecutor) RemoveContents(path string, limit int) error

func (*RealOsExecutor) Rename

func (ex *RealOsExecutor) Rename(oldPath, newPath string) error

func (*RealOsExecutor) ResolvePath

func (ex *RealOsExecutor) ResolvePath(path string) (string, error)

func (*RealOsExecutor) SetStderr

func (ex *RealOsExecutor) SetStderr(v io.Writer)

func (*RealOsExecutor) SetStdin

func (ex *RealOsExecutor) SetStdin(v io.Reader)

func (*RealOsExecutor) SetStdout

func (ex *RealOsExecutor) SetStdout(v io.Writer)

func (*RealOsExecutor) Setenv

func (ex *RealOsExecutor) Setenv(key, value string) error

func (*RealOsExecutor) Stat

func (ex *RealOsExecutor) Stat(filename string) (os.FileInfo, error)

func (*RealOsExecutor) Stderr

func (ex *RealOsExecutor) Stderr() io.Writer

func (*RealOsExecutor) Stdin

func (ex *RealOsExecutor) Stdin() io.Reader

func (*RealOsExecutor) Stdout

func (ex *RealOsExecutor) Stdout() io.Writer
func (ex *RealOsExecutor) Symlink(oldname, newname string) error

func (*RealOsExecutor) TempDir

func (ex *RealOsExecutor) TempDir(dir, prefix string) (name string, err error)

func (*RealOsExecutor) TempFile

func (ex *RealOsExecutor) TempFile(dir, pattern string) (f *os.File, err error)

func (*RealOsExecutor) UserHomeDir

func (ex *RealOsExecutor) UserHomeDir() (string, error)

func (*RealOsExecutor) WriteFile

func (ex *RealOsExecutor) WriteFile(path string, data []byte, perm os.FileMode) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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