INNER CODE UNIT · Go

sectionStart

kluctl/kluctl · internal/replace-commands-help/main.go:152

	sectionStart := -1
	for i := 0; i < len(lines); i++ {
		indent := countIndent(lines[i])
		if strings.HasPrefix(lines[i][indent:], fmt.Sprintf("%s:", section)) {
			sectionStart = i
			break
		}
	}
	if sectionStart == -1 {
		log.Fatalf("Section %s not found in command %s", section, command)
	}

	var ret []string
	ret = append(ret, lines[sectionStart])
	for i := sectionStart + 1; i < len(lines); i++ {
		indent := countIndent(lines[i])
		if len(lines[i]) != 0 && indent == 0 && lines[i][len(lines[i])-1] == ':' {
			// new section has started

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…