浏览代码

Fix wrong indentation in yaml output

Vadim Markovtsev 7 年之前
父节点
当前提交
810f579949
共有 1 个文件被更改,包括 9 次插入3 次删除
  1. 9 3
      stdout/utils.go

+ 9 - 3
stdout/utils.go

@@ -5,7 +5,7 @@ import (
 	"sort"
 	"strconv"
 	"strings"
-	
+
 	"gopkg.in/src-d/hercules.v2"
 )
 
@@ -43,6 +43,7 @@ func PrintMatrix(matrix [][]int64, name string, fixNegative bool) {
 		indent += 2
 	}
 	// print the resulting triangular matrix
+	first := true
 	for _, status := range matrix {
 		fmt.Print(strings.Repeat(" ", indent-1))
 		for i := 0; i < last; i++ {
@@ -55,7 +56,12 @@ func PrintMatrix(matrix [][]int64, name string, fixNegative bool) {
 					val = 0
 				}
 			}
-			fmt.Printf(" %[1]*[2]d", width, val)
+			if !first {
+				fmt.Printf(" %[1]*[2]d", width, val)
+			} else {
+				first = false
+				fmt.Printf("%d%s", val, strings.Repeat(" ", width-len(strconv.FormatInt(val, 10))))
+			}
 		}
 		fmt.Println()
 	}
@@ -120,7 +126,7 @@ func PrintCouples(result *hercules.CouplesResult, peopleDict []string) {
 }
 
 func sortByNumberOfFiles(
-		peopleFiles [][]int, peopleDict []string, filesDict []string) authorFilesList {
+	peopleFiles [][]int, peopleDict []string, filesDict []string) authorFilesList {
 	var pfl authorFilesList
 	for peopleIdx, files := range peopleFiles {
 		if peopleIdx < len(peopleDict) {