Documentation ¶
Index ¶
- func DotSlash(path string) string
- func EnsureNewline(b []byte) []byte
- func FindCueMod(path string) (root string, err error)
- func FindRootLeaf(target string) (root string, leaf string, err error)
- func MakeWalkFunc(a *txtar.Archive) fs.WalkDirFunc
- func Remove(ctx context.Context, path string)
- func RunInteractiveCmd(ctx context.Context, name string, args ...string) error
- type RunResult
- func RunCmd(ctx context.Context, name string, args ...string) (result RunResult, err error)
- func RunCmdA(ctx context.Context, w io.Writer, name string, args ...string) (result RunResult, err error)
- func RunCmdW(ctx context.Context, w io.Writer, name string, args ...string) (result RunResult, err error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DotSlash ¶ added in v0.100.0
DotSlash ensures a relative path has a leading ./ needed for CUE loading.
func EnsureNewline ¶
EnsureNewline adds a trailing newline if not already there.
func FindCueMod ¶ added in v0.98.0
FindCueMod returns the root module location containing the cue.mod.
func FindRootLeaf ¶ added in v0.98.0
FindRootLeaf returns the root path containing the cue.mod and the leaf path relative to the root for the given target path. FindRootLeaf calls filepath.Clean on the returned paths.
func MakeWalkFunc ¶
func MakeWalkFunc(a *txtar.Archive) fs.WalkDirFunc
Types ¶
type RunResult ¶
runResult holds the stdout and stderr of a command.
func RunCmd ¶
RunCmd runs a command within a context, captures its output, provides debug logging, and returns the result. Example:
result, err := RunCmd(ctx, "echo", "hello") if err != nil { return wrapper.Wrap(err) } fmt.Println(result.Stdout.String())
Output:
"hello\n"
Click to show internal directories.
Click to hide internal directories.