You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: cmd/root.go
+30-52Lines changed: 30 additions & 52 deletions
Original file line number
Diff line number
Diff line change
@@ -1,37 +1,35 @@
1
1
package cmd
2
2
3
3
import (
4
+
"context"
4
5
"fmt"
5
-
"log"
6
+
"io/ioutil"
6
7
"math"
7
8
"os"
8
9
"sort"
9
10
"text/tabwriter"
10
-
"time"
11
11
12
+
"github.com/augmentable-dev/gitpert/pkg/gitlog"
12
13
"github.com/go-git/go-git/v5"
13
-
"github.com/go-git/go-git/v5/plumbing/object"
14
-
"github.com/go-git/go-git/v5/storage/memory"
15
14
"github.com/spf13/cobra"
16
15
"github.com/src-d/enry/v2"
17
16
)
18
17
19
18
funchandleError(errerror) {
20
19
iferr!=nil {
21
-
log.Fatalln(err)
20
+
fmt.Println(err)
21
+
os.Exit(1)
22
22
}
23
23
}
24
24
25
25
var (
26
26
decayDaysint
27
-
fullbool
28
27
remotebool
29
28
)
30
29
31
30
funcinit() {
32
31
rootCmd.Flags().IntVarP(&decayDays, "decay-rate", "d", 30, "determines how long it takes for the impact of a commit to halve, based on how recently the commit was made")
33
32
rootCmd.Flags().BoolVarP(&remote, "remote", "r", false, "whether or not this is a remote repository")
34
-
rootCmd.Flags().BoolVarP(&full, "full", "f", false, "include all commits when calculating scores")
35
33
}
36
34
37
35
varrootCmd=&cobra.Command{
@@ -50,43 +48,32 @@ var rootCmd = &cobra.Command{
50
48
repoPath=p
51
49
}
52
50
53
-
varrepo*git.Repository
54
-
// if the remote flag is set, clone the repo (using repoPath) into memory
0 commit comments