aboutsummaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorAqua-sama <aqua@iserlohn-fortress.net>2018-03-06 16:06:32 +0100
committerAqua-sama <aqua@iserlohn-fortress.net>2018-03-06 16:06:32 +0100
commita16efaa441bad8cb687aa5aede82684998291c99 (patch)
treef17ef88b20bb40a5a8687018eb9c6ff6dd4e3936 /tools
parentAdded poi-config (diff)
downloadsmolbote-a16efaa441bad8cb687aa5aede82684998291c99.tar.xz
Show local branch and commit in updater
Diffstat (limited to 'tools')
-rw-r--r--tools/updater/main.go23
1 files changed, 14 insertions, 9 deletions
diff --git a/tools/updater/main.go b/tools/updater/main.go
index e5e377c..eda229b 100644
--- a/tools/updater/main.go
+++ b/tools/updater/main.go
@@ -30,16 +30,17 @@ func branchmap(repository string) (branches map[string]string, err error) {
return
}
-func poi(executable string) (version string, err error) {
- cmd := exec.Command(executable, "--version")
+func poi(executable string) (version string, commit string, err error) {
+ cmd := exec.Command(executable, "--build")
// wait for complete
err = cmd.Wait()
// return output
output, err := cmd.Output()
- v := strings.Split(string(output), "-")
- version = v[len(v)-1]
+ v := strings.Split(string(output), ":")
+ version = v[0]
+ commit = v[1]
return
}
@@ -57,17 +58,21 @@ func main() {
os.Exit(0)
}
- fmt.Println("Getting poi --version")
- poi_version, err := poi(*execFlag)
+ fmt.Println("Getting poi build...")
+ if *verboseFlag {
+ fmt.Println("[exec =", *execFlag, "]")
+ }
+
+ poi_branch, poi_commit, err := poi(*execFlag)
if err != nil {
fmt.Println("error:", err)
}
- fmt.Println(poi_version)
+ fmt.Println("-", poi_branch, ":", poi_commit)
// get branchmap
fmt.Println("Getting branchmap...")
if *verboseFlag {
- fmt.Println("for repository", *repoFlag)
+ fmt.Println("[repo =", *repoFlag, "]")
}
branches, err := branchmap(*repoFlag)
@@ -77,7 +82,7 @@ func main() {
}
for branch, commit := range branches {
- fmt.Println("-", branch, ":", commit[0:len(poi_version)-1])
+ fmt.Println("-", branch, ":", commit[0:12])
}
}