summaryrefslogtreecommitdiffstats
path: root/main.go
diff options
context:
space:
mode:
authorNicolas Borboën <ponsfrilus@gmail.com>2018-08-07 16:15:23 +0200
committerNicolas Borboën <ponsfrilus@gmail.com>2018-08-07 16:15:23 +0200
commit4d9d2b134f7578cc5ff394956f9ecf5ccaf03566 (patch)
treef920ec5f6c6a4dace2e06728934160d6f7221d60 /main.go
parent6cb0a14f33e7ebbbc248d35af1aa99cf124809c0 (diff)
Add `lazygit --v` version
* Recover Rev and Build Date from build args * Moved `debuggingPointer` and `versionFlag` to `var()` * Print version and exit in case of `-v` or `--v`
Diffstat (limited to 'main.go')
-rw-r--r--main.go13
1 files changed, 10 insertions, 3 deletions
diff --git a/main.go b/main.go
index b3586b04e..bcbce909a 100644
--- a/main.go
+++ b/main.go
@@ -14,6 +14,10 @@ import (
var (
startTime time.Time
debugging bool
+ Rev string
+ builddate string
+ debuggingPointer = flag.Bool("debug", false, "a boolean")
+ versionFlag = flag.Bool("v", false, "Print the current version")
)
func homeDirectory() string {
@@ -58,11 +62,14 @@ func navigateToRepoRootDirectory() {
}
func main() {
- debuggingPointer := flag.Bool("debug", false, "a boolean")
- flag.Parse()
+ startTime = time.Now()
debugging = *debuggingPointer
devLog("\n\n\n\n\n\n\n\n\n\n")
- startTime = time.Now()
+ flag.Parse()
+ if *versionFlag {
+ fmt.Printf("rev=%s, build date=%s", Rev, builddate)
+ os.Exit(0)
+ }
verifyInGitRepo()
navigateToRepoRootDirectory()
run()