Skip to content

Commit 30cb6e0

Browse files
committed
Print download status
1 parent 3818b3e commit 30cb6e0

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed

commands/new.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -189,12 +189,10 @@ func newClient() error {
189189
}
190190

191191
if language == "go" || language == "ts" {
192-
cli.Begin("Generating event definitions...")
193192
err = util.CGGenEvents(eventsOutput, url, cgeVersion, language)
194193
if err != nil {
195194
return err
196195
}
197-
cli.Finish()
198196
}
199197

200198
return nil

util/cg_gen_events.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,11 @@ func CGGenEvents(outputDir, url, cgeVersion, language string) error {
5050
}
5151
}
5252

53+
cli.Begin("Generating event definitions...")
5354
_, err = Execute(true, filepath.Join(cgGenEventsPath, exeName), url, "--languages", language, "--output", outputDir)
55+
if err == nil {
56+
cli.Finish()
57+
}
5458
return err
5559
}
5660

@@ -151,6 +155,9 @@ func installCGGenEvents(version string) (string, error) {
151155
filename = fmt.Sprintf("cg-gen-events-%s-%s.zip", runtime.GOOS, runtime.GOARCH)
152156
}
153157

158+
cli.Begin("Downloading cg-gen-events v%s...", version)
159+
defer cli.Finish()
160+
154161
res, err := http.Get(fmt.Sprintf("https://github.com/code-game-project/cg-gen-events/releases/download/v%s/%s", version, filename))
155162
if err != nil {
156163
return "", err

util/modules.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,9 @@ func installModule(name, version string) (string, error) {
104104
filename = fmt.Sprintf("codegame-cli-%s-%s-%s.zip", name, runtime.GOOS, runtime.GOARCH)
105105
}
106106

107+
cli.Begin("Downloading codegame-cli-%s v%s...", name, version)
108+
defer cli.Finish()
109+
107110
res, err := http.Get(fmt.Sprintf("https://github.com/code-game-project/codegame-cli-%s/releases/download/v%s/%s", name, version, filename))
108111
if err != nil {
109112
return "", err

0 commit comments

Comments
 (0)