diff --git a/cli/worker/printer.go b/cli/worker/printer.go index 5a69154..36395e9 100644 --- a/cli/worker/printer.go +++ b/cli/worker/printer.go @@ -187,7 +187,8 @@ func (s *helpPrinter) printHeader(ctx context.Context, sb *strings.Builder, cc c if cc.Root() == nil { logz.Fatal("unsatisfied link to root: cc.Root() is invalid", "cc", cc) } - line := cc.Root().Header() + header := cc.Root().Header() + line := exec.StripLeftTabs(header) _, _ = sb.WriteString(s.Translate(line, color.FgDefault)) _, _ = sb.WriteString("\n") _, _, _ = pc, cols, tabbedW @@ -213,6 +214,8 @@ func (s *helpPrinter) printDesc(ctx context.Context, sb *strings.Builder, cc cli desc := cc.DescLong() if desc != "" { _, _ = sb.WriteString("\nDescription:\n\n") + desc = exec.StripLeftTabs(desc) + desc = pc.Translate(desc) line := s.Translate(desc, color.FgDefault) line = exec.LeftPad(line, 2) _, _ = sb.WriteString(line) @@ -224,7 +227,9 @@ func (s *helpPrinter) printExamples(ctx context.Context, sb *strings.Builder, cc examples := cc.Examples() if examples != "" { _, _ = sb.WriteString("\nExamples:\n\n") - line := s.Translate(examples, color.FgDefault) + str := exec.StripLeftTabs(examples) + str = pc.Translate(str) + line := s.Translate(str, color.FgDefault) line = exec.LeftPad(line, 2) _, _ = sb.WriteString(line) } @@ -235,7 +240,8 @@ func (s *helpPrinter) printTailLine(ctx context.Context, sb *strings.Builder, cc footer := strings.TrimSpace(cc.Root().Footer()) if footer != "" { _, _ = sb.WriteString("\n") - line := fmt.Sprintf("%s", footer) + str := exec.StripLeftTabs(footer) + line := fmt.Sprintf("%s", str) _, _ = sb.WriteString(s.Translate(line, color.FgDefault)) if !strings.HasSuffix(footer, "\n") { _, _ = sb.WriteString("\n") diff --git a/pkg/exec/tool.go b/pkg/exec/tool.go index f1f42cd..b3d00f1 100644 --- a/pkg/exec/tool.go +++ b/pkg/exec/tool.go @@ -26,7 +26,6 @@ func toStringSimple(i interface{}) string { func StripLeftTabs(s string) string { return stripLeftTabs(s) } func stripLeftTabs(s string) string { - var lines []string var tabs int = 1000 var emptyLines []int