Skip to content

Commit

Permalink
fix(subject): fix doc format (#8)
Browse files Browse the repository at this point in the history
  • Loading branch information
masahiro331 authored Feb 10, 2022
1 parent 844007a commit 6b8413c
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,10 +108,22 @@ type TypeRule struct {

type TypeRules []TypeRule

func (typeRules TypeRules) getLongestTypeLength() int {
length := 0
for _, tr := range typeRules {
if length < len(tr.Type) {
length = len(tr.Type)
}
}
return length
}

func (typeRules TypeRules) String() string {
ret := "Allowed <type> values\n"

spaceLength := typeRules.getLongestTypeLength() + 2
for _, tr := range typeRules {
ret += fmt.Sprintf("%s\t%s\n", textBrightYellow(tr.Type), tr.Description)
ret += fmt.Sprintf("%s%s%s\n", textBrightYellow(tr.Type), strings.Repeat(" ", spaceLength-len(tr.Type)), tr.Description)
}

return ret
Expand Down

0 comments on commit 6b8413c

Please sign in to comment.