Documentation
¶
Overview ¶
Copyright 2023 the u-root Authors. All rights reserved Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
Copyright 2023 the u-root Authors. All rights reserved Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
Package core provides an interface and basic funcionalities for the core utils implementations.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Base ¶
type Base struct {
Stdin io.Reader
Stdout io.Writer
Stderr io.Writer
WorkingDir string
LookupEnv LookupEnvFunc
}
Base is a struct that holds common fields for commands.
func (*Base) Getenv ¶
Getenv is a helper to retrieve an environment variable value without the extra bool return.
func (*Base) ResolvePath ¶
ResolvePath resolves a path relative to the working directory.
func (*Base) SetLookupEnv ¶
func (b *Base) SetLookupEnv(lookupEnv LookupEnvFunc)
SetLookupEnv sets the function used to look up environment variables.
func (*Base) SetWorkingDir ¶
SetWorkingDir sets the working directory for the command.
type Command ¶
type Command interface {
SetIO(stdin io.Reader, stdout io.Writer, stderr io.Writer)
SetWorkingDir(workingDir string)
SetLookupEnv(lookupEnv LookupEnvFunc)
Run(args ...string) error
RunContext(ctx context.Context, args ...string) error
}
Command is an interface that defines the methods for executing a command.
type LookupEnvFunc ¶
LookupEnvFunc is a function type that looks up an environment variable.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package base64 implements the base64 core utility.
|
Package base64 implements the base64 core utility. |
|
Package cat implements the cat core utility.
|
Package cat implements the cat core utility. |
|
Package chmod implements the chmod core utility.
|
Package chmod implements the chmod core utility. |
|
Package cp implements the cp core utility.
|
Package cp implements the cp core utility. |
|
Package find implements the find core utility.
|
Package find implements the find core utility. |
|
Package gzip implements the gzip command.
|
Package gzip implements the gzip command. |
|
Package ls implements the ls core utility.
|
Package ls implements the ls core utility. |
|
Package mkdir implements the mkdir core utility.
|
Package mkdir implements the mkdir core utility. |
|
Package mktemp implements the mktemp core utility.
|
Package mktemp implements the mktemp core utility. |
|
Package mv implements the mv core utility.
|
Package mv implements the mv core utility. |
|
Package rm implements the rm core utility.
|
Package rm implements the rm core utility. |
|
Package shasum implements the shasum core utility.
|
Package shasum implements the shasum core utility. |
|
Package tar implements the tar command.
|
Package tar implements the tar command. |
|
Package touch implements the touch core utility.
|
Package touch implements the touch core utility. |
|
Package xargs implements the xargs core utility.
|
Package xargs implements the xargs core utility. |