From 75f1015a9f896e46e94454e52fe15a782c18c740 Mon Sep 17 00:00:00 2001 From: John Bryan Sazon Date: Fri, 27 Apr 2018 20:43:36 +0800 Subject: [PATCH] Create a gotalink.txt for index.html during cmd call --- .gitignore | 1 + cmd/nexus.go | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/.gitignore b/.gitignore index 0c78593..042f058 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ +gotalink.txt gota ios_assets/ android_assets/ diff --git a/cmd/nexus.go b/cmd/nexus.go index 54b4b06..a203294 100644 --- a/cmd/nexus.go +++ b/cmd/nexus.go @@ -15,8 +15,10 @@ package cmd import ( + "io/ioutil" "log" "os" + "strings" nexuspkg "github.com/bzon/gota/nexus" "github.com/spf13/cobra" @@ -39,6 +41,12 @@ var nexusCmd = &cobra.Command{ } for _, v := range assets { log.Println("file uploaded:", v) + // write the index.html file (the ota link) to a file + if strings.Contains(v, "index.html") { + if err := ioutil.WriteFile("gotalink.txt", []byte(v), 0644); err != nil { + log.Fatal(err) + } + } } }, }