@@ -98,7 +98,7 @@ func ToTabularMarkdown(cmd *cli.Command, appPath string) (string, error) {
9898// ToTabularToFileBetweenTags creates a tabular markdown documentation for the `*App` and updates the file between
9999// the tags in the file. The function errors if either parsing or writing of the string fails.
100100func ToTabularToFileBetweenTags (cmd * cli.Command , appPath , filePath string , startEndTags ... string ) error {
101- var start , end = "<!--GENERATED:CLI_DOCS-->" , "<!--/GENERATED:CLI_DOCS-->" // default tags
101+ start , end : = "<!--GENERATED:CLI_DOCS-->" , "<!--/GENERATED:CLI_DOCS-->" // default tags
102102
103103 if len (startEndTags ) == 2 {
104104 start , end = startEndTags [0 ], startEndTags [1 ]
@@ -128,7 +128,7 @@ func ToTabularToFileBetweenTags(cmd *cli.Command, appPath, filePath string, star
128128 updated := re .ReplaceAll (content , []byte (strings .Join ([]string {start , comment , md , end }, "\n " )))
129129
130130 // write updated content to file
131- if err = os .WriteFile (filePath , updated , 0664 ); err != nil {
131+ if err = os .WriteFile (filePath , updated , 0o664 ); err != nil {
132132 return err
133133 }
134134
@@ -366,10 +366,10 @@ type tabularTemplate struct{}
366366
367367// PrepareCommands converts CLI commands into a structs for the rendering.
368368func (tt tabularTemplate ) PrepareCommands (commands []* cli.Command , appPath , parentCommandName string , level uint ) []cliTabularCommandTemplate {
369- var result = make ([]cliTabularCommandTemplate , 0 , len (commands ))
369+ result : = make ([]cliTabularCommandTemplate , 0 , len (commands ))
370370
371371 for _ , cmd := range commands {
372- var command = cliTabularCommandTemplate {
372+ command : = cliTabularCommandTemplate {
373373 AppPath : appPath ,
374374 Name : strings .TrimSpace (strings .Join ([]string {parentCommandName , cmd .Name }, " " )),
375375 Aliases : cmd .Aliases ,
@@ -396,7 +396,7 @@ func (tt tabularTemplate) PrepareCommands(commands []*cli.Command, appPath, pare
396396
397397// PrepareFlags converts CLI flags into a structs for the rendering.
398398func (tt tabularTemplate ) PrepareFlags (flags []cli.Flag ) []cliTabularFlagTemplate {
399- var result = make ([]cliTabularFlagTemplate , 0 , len (flags ))
399+ result : = make ([]cliTabularFlagTemplate , 0 , len (flags ))
400400
401401 for _ , appFlag := range flags {
402402 flag , ok := appFlag .(cli.DocGenerationFlag )
@@ -458,7 +458,7 @@ func (tabularTemplate) PrepareMultilineString(s string) string {
458458}
459459
460460func (tabularTemplate ) Prettify (s string ) string {
461- var max = func (x , y int ) int {
461+ max : = func (x , y int ) int {
462462 if x > y {
463463 return x
464464 }
@@ -469,14 +469,14 @@ func (tabularTemplate) Prettify(s string) string {
469469
470470 // search for tables
471471 for _ , rawTable := range regexp .MustCompile (`(?m)^(\|[^\n]+\|\r?\n)((?:\|:?-+:?)+\|)(\n(?:\|[^\n]+\|\r?\n?)*)?$` ).FindAllString (s , - 1 ) {
472- var lines = strings .FieldsFunc (rawTable , func (r rune ) bool { return r == '\n' })
472+ lines : = strings .FieldsFunc (rawTable , func (r rune ) bool { return r == '\n' })
473473
474474 if len (lines ) < 3 { // header, separator, body
475475 continue
476476 }
477477
478478 // parse table into the matrix
479- var matrix = make ([][]string , 0 , len (lines ))
479+ matrix : = make ([][]string , 0 , len (lines ))
480480 for _ , line := range lines {
481481 items := strings .FieldsFunc (strings .Trim (line , "| " ), func (r rune ) bool { return r == '|' })
482482
@@ -488,13 +488,13 @@ func (tabularTemplate) Prettify(s string) string {
488488 }
489489
490490 // determine centered columns
491- var centered = make ([]bool , 0 , len (matrix [1 ]))
491+ centered : = make ([]bool , 0 , len (matrix [1 ]))
492492 for _ , cell := range matrix [1 ] {
493493 centered = append (centered , strings .HasPrefix (cell , ":" ) && strings .HasSuffix (cell , ":" ))
494494 }
495495
496496 // calculate max lengths
497- var lengths = make ([]int , len (matrix [0 ]))
497+ lengths : = make ([]int , len (matrix [0 ]))
498498 for n , row := range matrix {
499499 for i , cell := range row {
500500 if n == 1 {
@@ -592,7 +592,7 @@ func getFlagDefaultValue(f cli.DocGenerationFlag) (value, text string) {
592592 return v .GetValue (), ""
593593 }
594594
595- var ref = reflect .ValueOf (f )
595+ ref : = reflect .ValueOf (f )
596596 if ref .Kind () != reflect .Ptr {
597597 return "" , ""
598598 } else {
0 commit comments