package
2.0.0-20240912215352-76cc7c8565c5
Repository: https://github.com/osbuild/weldr-client.git
Documentation: pkg.go.dev
# Functions
AddRootCommand adds a cobra command to the list of root commands.
Execute runs the commands on the commandline.
ExecuteTest runs the command passed in via args and captures the output into buf returns the command executed, captured output, and any errors The captured output is stored in temporary files which can be accessed via the OutputCapture.Stdout and Outputcapture.Stderr File pointers.
ExecutionError prints an error to stderr, sets silent flags on the cobra command, and returns an error to the caller suitable for assignment to error.
ExecutionErrors prints a list of errors to stderr, then calls ExecutionError.
GetCommaArgs returns a list of the arguments, split by commas and spaces They can be grouped or separated, the return list should be the same for all variations empty fields, eg.
Init sets up Cobra and adds the doc command to the root cmdline parser.
IsJSONList returns true if the data unmarshals to a json list.
LogToFile appends a line of text to a file used for debugging problems during development.
MakeTarBytes makes a simple tar file with a filename and some data in it it returns it as a slice of bytes.
NewOutputCapture returns an initialized struct with stdout and stderr redirected to files The user needs to call .Rewind() before reading the output And they need to call .Close() to cleanup the temporary files and restore os.Stdout and os.Stderr.
PrintWrap prints a string wrapped at columns and subsequent lines indented.
SetupCmdTest initializes the weldr client with a Mock Client used to capture test details Pass in a function to be run when the client queries the server.
# Variables
Client is the weldr.Client used to communicate with the server.
JSONOutput is the state of --json cmdline flag.
Version is set by the build.
# Structs
OutputCapture holds the details used for capturing output during testing.