package main import ( "fmt" "github.com/openshift/origin/test/extended/util/cli" ) func main() { cmd := cli.NewCmd("oc", "get", "pods") output, err := cmd.Run() if err != nil { panic(err) } fmt.Println(output) }
package main import ( "fmt" "github.com/openshift/origin/test/extended/util/cli" ) func main() { cmd := cli.NewCmd("oc", "project", "--skip-config-write", "myproject") output, err := cmd.Run() if err != nil { panic(err) } fmt.Println(output) }This code creates a new `oc` command for switching to the `myproject` project, and skips writing the configuration file. The command is then executed using the `Run` method, and the output is printed to the console. In conclusion, the `CLI` sub-package of `github.com.openshift.origin.test.extended.util` is used for running OpenShift CLI commands within Go code. It provides methods for creating and running commands, as well as handling output and errors.