Documentation ¶
Index ¶
- Constants
- func AppendCodeAtTheEnd(filename, code string) error
- func AppendCodeIfNotExist(filename, code string) error
- func CommentCode(filename, target, prefix string) error
- func EnsureExistAndReplace(input, match, replace string) (string, error)
- func GetNonEmptyLines(output string) []string
- func HasFileContentWith(path, text string) (bool, error)
- func InsertCode(filename, target, code string) error
- func InsertCodeIfNotExist(filename, target, code string) error
- func RandomSuffix() (string, error)
- func ReplaceInFile(path, old, new string) error
- func ReplaceRegexInFile(path, match, replace string) error
- func RunCmd(msg, cmd string, args ...string) error
- func UncommentCode(filename, target, prefix string) error
- func YesNo(reader *bufio.Reader) bool
Constants ¶
const (
// KubebuilderBinName define the name of the kubebuilder binary to be used in the tests
KubebuilderBinName = "kubebuilder"
)
Variables ¶
This section is empty.
Functions ¶
func AppendCodeAtTheEnd ¶
AppendCodeAtTheEnd appends the given code at the end of the file.
func AppendCodeIfNotExist ¶
AppendCodeIfNotExist checks if the code does not already exist in the file, and if not, appends it to the end.
func CommentCode ¶ added in v4.1.0
CommentCode searches for target in the file and adds the comment prefix to the target content. The target content may span multiple lines.
func EnsureExistAndReplace ¶
EnsureExistAndReplace check if the content exists and then do the replace
func GetNonEmptyLines ¶
GetNonEmptyLines converts given command output string into individual objects according to line breakers, and ignores the empty elements in it.
func HasFileContentWith ¶
HasFileContentWith check if given `text` can be found in file
func InsertCode ¶
InsertCode searches target content in the file and insert `toInsert` after the target.
func InsertCodeIfNotExist ¶
InsertCodeIfNotExist insert code if it does not already exists
func ReplaceInFile ¶
ReplaceInFile replaces all instances of old with new in the file at path.
func ReplaceRegexInFile ¶
ReplaceRegexInFile finds all strings that match `match` and replaces them with `replace` in the file at path.
func RunCmd ¶
RunCmd prints the provided message and command and then executes it binding stdout and stderr
func UncommentCode ¶
UncommentCode searches for target in the file and remove the comment prefix of the target content. The target content may span multiple lines.
Types ¶
This section is empty.