-
-
Notifications
You must be signed in to change notification settings - Fork 107
/
info.go
33 lines (28 loc) · 920 Bytes
/
info.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
package cmd
import (
"fmt"
"github.com/chriswalz/bit/gitextras"
"github.com/spf13/cobra"
"os"
"path/filepath"
)
// infoCmd represents the info command
var infoCmd = &cobra.Command{
Use: "info",
Short: "Get general information about the status of your repository",
Long: ``,
Run: func(cmd *cobra.Command, args []string) {
os.MkdirAll(filepath.Dir("/tmp/bit/git-extras/"), os.ModePerm)
fmt.Println("--- INFO ---")
RunInTerminalWithColor("/bin/sh", []string{`-c`, gitextras.GitInfo})
fmt.Println("--- SUMMARY ---")
RunInTerminalWithColor("/bin/sh", []string{`-c`, gitextras.GitSummary})
fmt.Println("\n--- EFFORT ---")
fmt.Println("\nCommits | Files")
RunInTerminalWithColor("/bin/sh", []string{`-c`, `git log --pretty=format: --name-only | sort | uniq -c | sort -rg | awk 'NR > 1 { print }' | head -15`})
},
//Args: cobra.MaximumNArgs(1),
}
func init() {
ShellCmd.AddCommand(infoCmd)
}