Documentation
¶
Index ¶
- Constants
- func SanitizeBinaryOutput(str string) string
- type CapturedShellResult
- type CreateDirOptions
- type ExecOptions
- type ExecResult
- type ExecutionEnv
- type ExecutionError
- type FileError
- type FileInfo
- type FileSystem
- type LocalExecutionEnv
- func (e *LocalExecutionEnv) AbsolutePath(path string) string
- func (e *LocalExecutionEnv) AppendFile(ctx context.Context, path string, content []byte) error
- func (e *LocalExecutionEnv) CWD() string
- func (e *LocalExecutionEnv) CanonicalPath(ctx context.Context, path string) (string, error)
- func (e *LocalExecutionEnv) Cleanup(context.Context) error
- func (e *LocalExecutionEnv) CreateDir(ctx context.Context, path string, options CreateDirOptions) error
- func (e *LocalExecutionEnv) CreateTempDir(ctx context.Context, prefix string) (string, error)
- func (e *LocalExecutionEnv) CreateTempFile(ctx context.Context, options TempFileOptions) (string, error)
- func (e *LocalExecutionEnv) Exec(ctx context.Context, command string, options ExecOptions) (ExecResult, error)
- func (e *LocalExecutionEnv) Exists(ctx context.Context, path string) (bool, error)
- func (e *LocalExecutionEnv) FileInfo(ctx context.Context, path string) (FileInfo, error)
- func (e *LocalExecutionEnv) JoinPath(parts ...string) string
- func (e *LocalExecutionEnv) ListDir(ctx context.Context, path string) ([]FileInfo, error)
- func (e *LocalExecutionEnv) ReadBinaryFile(ctx context.Context, path string) ([]byte, error)
- func (e *LocalExecutionEnv) ReadTextFile(ctx context.Context, path string) (string, error)
- func (e *LocalExecutionEnv) ReadTextLines(ctx context.Context, path string, maxLines int) ([]string, error)
- func (e *LocalExecutionEnv) Remove(ctx context.Context, path string, options RemoveOptions) error
- func (e *LocalExecutionEnv) WriteFile(ctx context.Context, path string, content []byte) error
- type LocalExecutionOption
- type RemoveOptions
- type Shell
- type TempFileOptions
Constants ¶
View Source
const ( FileKindFile = "file" FileKindDirectory = "directory" FileKindSymlink = "symlink" FileErrorAborted = "aborted" FileErrorNotFound = "not_found" FileErrorPermissionDenied = "permission_denied" FileErrorNotDirectory = "not_directory" FileErrorIsDirectory = "is_directory" FileErrorInvalid = "invalid" FileErrorNotSupported = "not_supported" FileErrorUnknown = "unknown" ExecutionErrorAborted = "aborted" ExecutionErrorTimeout = "timeout" ExecutionErrorSpawnError = "spawn_error" ExecutionErrorCallbackError = "callback_error" ExecutionErrorUnknown = "unknown" )
Variables ¶
This section is empty.
Functions ¶
func SanitizeBinaryOutput ¶
Types ¶
type CapturedShellResult ¶
type CapturedShellResult struct {
Output string
FullOutputPath string
Truncated bool
ExecResult ExecResult
}
func ExecuteShellWithCapture ¶
func ExecuteShellWithCapture(ctx context.Context, env *LocalExecutionEnv, command string, maxInlineBytes int) (CapturedShellResult, error)
type CreateDirOptions ¶
type CreateDirOptions struct {
Recursive bool
}
type ExecOptions ¶
type ExecResult ¶
type ExecutionEnv ¶
type ExecutionEnv interface {
FileSystem
Shell
}
type ExecutionError ¶
func (*ExecutionError) Error ¶
func (e *ExecutionError) Error() string
func (*ExecutionError) Unwrap ¶
func (e *ExecutionError) Unwrap() error
type FileSystem ¶
type FileSystem interface {
CWD() string
AbsolutePath(path string) string
JoinPath(parts ...string) string
ReadTextFile(ctx context.Context, path string) (string, error)
ReadTextLines(ctx context.Context, path string, maxLines int) ([]string, error)
ReadBinaryFile(ctx context.Context, path string) ([]byte, error)
WriteFile(ctx context.Context, path string, content []byte) error
AppendFile(ctx context.Context, path string, content []byte) error
FileInfo(ctx context.Context, path string) (FileInfo, error)
ListDir(ctx context.Context, path string) ([]FileInfo, error)
CanonicalPath(ctx context.Context, path string) (string, error)
Exists(ctx context.Context, path string) (bool, error)
CreateDir(ctx context.Context, path string, options CreateDirOptions) error
Remove(ctx context.Context, path string, options RemoveOptions) error
CreateTempDir(ctx context.Context, prefix string) (string, error)
CreateTempFile(ctx context.Context, options TempFileOptions) (string, error)
Cleanup(ctx context.Context) error
}
type LocalExecutionEnv ¶
type LocalExecutionEnv struct {
// contains filtered or unexported fields
}
func MustLocalExecutionEnv ¶
func MustLocalExecutionEnv(cwd string, options ...LocalExecutionOption) *LocalExecutionEnv
func NewLocalExecutionEnv ¶
func NewLocalExecutionEnv(cwd string, options ...LocalExecutionOption) (*LocalExecutionEnv, error)
func (*LocalExecutionEnv) AbsolutePath ¶
func (e *LocalExecutionEnv) AbsolutePath(path string) string
func (*LocalExecutionEnv) AppendFile ¶
func (*LocalExecutionEnv) CWD ¶
func (e *LocalExecutionEnv) CWD() string
func (*LocalExecutionEnv) CanonicalPath ¶
func (*LocalExecutionEnv) CreateDir ¶
func (e *LocalExecutionEnv) CreateDir(ctx context.Context, path string, options CreateDirOptions) error
func (*LocalExecutionEnv) CreateTempDir ¶
func (*LocalExecutionEnv) CreateTempFile ¶
func (e *LocalExecutionEnv) CreateTempFile(ctx context.Context, options TempFileOptions) (string, error)
func (*LocalExecutionEnv) Exec ¶
func (e *LocalExecutionEnv) Exec(ctx context.Context, command string, options ExecOptions) (ExecResult, error)
func (*LocalExecutionEnv) JoinPath ¶
func (e *LocalExecutionEnv) JoinPath(parts ...string) string
func (*LocalExecutionEnv) ReadBinaryFile ¶
func (*LocalExecutionEnv) ReadTextFile ¶
func (*LocalExecutionEnv) ReadTextLines ¶
func (*LocalExecutionEnv) Remove ¶
func (e *LocalExecutionEnv) Remove(ctx context.Context, path string, options RemoveOptions) error
type LocalExecutionOption ¶
type LocalExecutionOption func(*LocalExecutionEnv)
func WithShellPath ¶
func WithShellPath(path string) LocalExecutionOption
type RemoveOptions ¶
type Shell ¶
type Shell interface {
Exec(ctx context.Context, command string, options ExecOptions) (ExecResult, error)
Cleanup(ctx context.Context) error
}
type TempFileOptions ¶
Click to show internal directories.
Click to hide internal directories.