INNER CODE UNIT · Go
getHelpSection
kluctl/kluctl · internal/replace-commands-help/main.go:130
func getHelpSection(command string, section string) []string {
log.Printf("Getting section '%s' from command '%s'", section, command)
exe, err := os.Executable()
if err != nil {
log.Fatal(err)
}
args := strings.Split(command, " ")
args = append(args, "--help")
helpCmd := exec.Command(exe, args...)
helpCmd.Env = os.Environ()
helpCmd.Env = append(helpCmd.Env, "CALL_KLUCTL=true")
out, err := helpCmd.CombinedOutput()
if err != nil {
log.Fatal(err)