2018-05-19 03:16:34 +02:00
|
|
|
package main
|
|
|
|
|
2018-06-02 00:35:49 +02:00
|
|
|
import (
|
2018-07-21 07:51:18 +02:00
|
|
|
"flag"
|
|
|
|
"fmt"
|
2018-09-13 17:23:11 +02:00
|
|
|
"log"
|
2018-07-21 07:51:18 +02:00
|
|
|
"os"
|
2018-08-09 05:21:30 +02:00
|
|
|
"path/filepath"
|
2018-08-18 09:28:03 +02:00
|
|
|
"runtime"
|
2018-07-21 07:51:18 +02:00
|
|
|
|
2018-08-12 11:31:27 +02:00
|
|
|
"github.com/jesseduffield/lazygit/pkg/app"
|
|
|
|
"github.com/jesseduffield/lazygit/pkg/config"
|
2018-06-02 00:35:49 +02:00
|
|
|
)
|
|
|
|
|
2018-06-05 11:30:55 +02:00
|
|
|
var (
|
2018-08-25 07:55:49 +02:00
|
|
|
commit string
|
|
|
|
version = "unversioned"
|
|
|
|
date string
|
|
|
|
buildSource = "unknown"
|
2018-08-08 10:57:27 +02:00
|
|
|
|
2018-08-26 10:42:25 +02:00
|
|
|
configFlag = flag.Bool("config", false, "Print the current default config")
|
2018-08-08 11:46:21 +02:00
|
|
|
debuggingFlag = flag.Bool("debug", false, "a boolean")
|
|
|
|
versionFlag = flag.Bool("v", false, "Print the current version")
|
2018-06-05 11:30:55 +02:00
|
|
|
)
|
2018-05-27 08:32:09 +02:00
|
|
|
|
2018-08-09 05:29:25 +02:00
|
|
|
func projectPath(path string) string {
|
|
|
|
gopath := os.Getenv("GOPATH")
|
|
|
|
return filepath.FromSlash(gopath + "/src/github.com/jesseduffield/lazygit/" + path)
|
|
|
|
}
|
|
|
|
|
2018-05-19 03:16:34 +02:00
|
|
|
func main() {
|
2018-08-07 16:15:23 +02:00
|
|
|
flag.Parse()
|
|
|
|
if *versionFlag {
|
2018-08-25 07:55:49 +02:00
|
|
|
fmt.Printf("commit=%s, build date=%s, build source=%s, version=%s, os=%s, arch=%s\n", commit, date, buildSource, version, runtime.GOOS, runtime.GOARCH)
|
2018-08-07 16:15:23 +02:00
|
|
|
os.Exit(0)
|
|
|
|
}
|
2018-08-27 10:55:56 +02:00
|
|
|
|
2018-08-26 10:42:25 +02:00
|
|
|
if *configFlag {
|
|
|
|
fmt.Printf("%s\n", config.GetDefaultConfig())
|
|
|
|
os.Exit(0)
|
|
|
|
}
|
2018-08-25 07:55:49 +02:00
|
|
|
appConfig, err := config.NewAppConfig("lazygit", version, commit, date, buildSource, debuggingFlag)
|
2018-08-15 13:34:25 +02:00
|
|
|
if err != nil {
|
2018-09-13 17:23:11 +02:00
|
|
|
log.Fatal(err.Error())
|
2018-08-12 11:31:27 +02:00
|
|
|
}
|
2018-08-15 13:34:25 +02:00
|
|
|
|
2018-09-02 17:18:33 +02:00
|
|
|
app, err := app.Setup(appConfig)
|
2018-08-18 11:43:58 +02:00
|
|
|
if err != nil {
|
2018-08-28 11:12:35 +02:00
|
|
|
app.Log.Error(err.Error())
|
2018-09-13 17:23:11 +02:00
|
|
|
log.Fatal(err.Error())
|
2018-08-18 11:43:58 +02:00
|
|
|
}
|
2018-08-29 21:47:48 +02:00
|
|
|
|
2018-08-12 13:04:47 +02:00
|
|
|
app.Gui.RunWithSubprocesses()
|
2018-05-19 03:16:34 +02:00
|
|
|
}
|