github.com/jfrog/frogbot/v2@v2.21.0/utils/outputwriter/simplifiedoutput.go (about)

     1  package outputwriter
     2  
     3  import (
     4  	"fmt"
     5  	"strings"
     6  )
     7  
     8  const (
     9  	simpleSeparator = ", "
    10  )
    11  
    12  type SimplifiedOutput struct {
    13  	MarkdownOutput
    14  }
    15  
    16  func (smo *SimplifiedOutput) Separator() string {
    17  	return simpleSeparator
    18  }
    19  
    20  func (smo *SimplifiedOutput) FormattedSeverity(severity, _ string) string {
    21  	return severity
    22  }
    23  
    24  func (smo *SimplifiedOutput) Image(source ImageSource) string {
    25  	return MarkAsBold(GetSimplifiedTitle(source))
    26  }
    27  
    28  func (smo *SimplifiedOutput) MarkInCenter(content string) string {
    29  	return content
    30  }
    31  
    32  func (smo *SimplifiedOutput) MarkAsDetails(summary string, subTitleDepth int, content string) string {
    33  	return fmt.Sprintf("%s\n%s", smo.MarkAsTitle(summary, subTitleDepth), content)
    34  }
    35  
    36  func (smo *SimplifiedOutput) MarkAsTitle(title string, subTitleDepth int) string {
    37  	if subTitleDepth == 0 {
    38  		return fmt.Sprintf("%s\n%s\n%s", SectionDivider(), title, SectionDivider())
    39  	}
    40  	return fmt.Sprintf("%s\n%s %s\n%s", SectionDivider(), strings.Repeat("#", subTitleDepth), title, SectionDivider())
    41  }