-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathgit-drs.go
More file actions
35 lines (29 loc) · 786 Bytes
/
git-drs.go
File metadata and controls
35 lines (29 loc) · 786 Bytes
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
34
35
package main
import (
"fmt"
"os"
"github.com/calypr/git-drs/cmd"
"github.com/calypr/git-drs/cmd/credentialhelper"
"github.com/calypr/git-drs/internal/drslog"
)
func main() {
_, err := drslog.NewLogger("", true)
if err != nil {
fmt.Printf("Failed to open log file: %v", err)
os.Exit(1)
}
// Keep credential helper out of the user-facing command tree/help output.
// Git invokes this path via `credential.helper=!git drs credential-helper`.
if len(os.Args) > 1 && os.Args[1] == "credential-helper" {
credentialhelper.Cmd.SetArgs(os.Args[2:])
if err := credentialhelper.Cmd.Execute(); err != nil {
drslog.Close()
os.Exit(1)
}
return
}
if err := cmd.RootCmd.Execute(); err != nil {
drslog.Close() // closes log file if there was one
os.Exit(1)
}
}