Skip to content

Commit 19a11ae

Browse files
committed
Use Bananenpro/cli lib
1 parent 4d15c6f commit 19a11ae

File tree

7 files changed

+16
-25
lines changed

7 files changed

+16
-25
lines changed

go.mod

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ module github.com/code-game-project/codegame-cli-js
33
go 1.18
44

55
require (
6+
github.com/Bananenpro/cli v0.1.2
67
github.com/code-game-project/codegame-cli v0.5.0
78
github.com/spf13/pflag v1.0.5
89
)

go.sum

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
github.com/AlecAivazis/survey/v2 v2.3.4 h1:pchTU9rsLUSvWEl2Aq9Pv3k0IE2fkqtGxazskAMd9Ng=
2-
github.com/AlecAivazis/survey/v2 v2.3.4/go.mod h1:hrV6Y/kQCLhIZXGcriDCUBtB3wnN7156gMXJ3+b23xM=
31
github.com/AlecAivazis/survey/v2 v2.3.5 h1:A8cYupsAZkjaUmhtTYv3sSqc7LO5mp1XDfqe5E/9wRQ=
42
github.com/AlecAivazis/survey/v2 v2.3.5/go.mod h1:4AuI9b7RjAR+G7v9+C4YSlX/YL3K3cWNXgWXOhllqvI=
3+
github.com/Bananenpro/cli v0.1.2 h1:X6Fb80PxfhIItabAjp4G9roLCpj7Q0FvYc5jxX/8nAw=
4+
github.com/Bananenpro/cli v0.1.2/go.mod h1:JBXpIAXo/D0rlsfgCViQBicjcJY6UWUldmxvKM+ijRc=
55
github.com/Netflix/go-expect v0.0.0-20220104043353-73e0943537d2 h1:+vx7roKuyA63nhn5WAunQHLTznkw5W8b1Xc0dNjp83s=
66
github.com/Netflix/go-expect v0.0.0-20220104043353-73e0943537d2/go.mod h1:HBCaDeC1lPdgDeDbhX8XFpy1jqjK0IBG8W5K+xYqA0w=
77
github.com/adrg/xdg v0.4.0 h1:RzRqFcjH4nE5C6oTAxhBtoE2IRyjBSa62SCbyPidvls=
@@ -40,8 +40,6 @@ golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBc
4040
golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
4141
golang.org/x/sys v0.0.0-20211025201205-69cdffdb9359/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
4242
golang.org/x/sys v0.0.0-20220422013727-9388b58f7150/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
43-
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a h1:dGzPydgVsqGcTRVwiLJ1jVbufYwmzD3LfVPLKsKg+0k=
44-
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
4543
golang.org/x/sys v0.0.0-20220608164250-635b8c9b7f68 h1:z8Hj/bl9cOV2grsOpEaQFUaly0JWN3i97mo3jXKJNp0=
4644
golang.org/x/sys v0.0.0-20220608164250-635b8c9b7f68/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
4745
golang.org/x/term v0.0.0-20210503060354-a79de5458b56/go.mod h1:tfny5GFUkzUvx4ps4ajbZsCe5lw1metzhBm9T3x7oIY=

main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ import (
66
"path/filepath"
77
"strings"
88

9+
"github.com/Bananenpro/cli"
910
"github.com/code-game-project/codegame-cli-js/new/client"
1011
"github.com/code-game-project/codegame-cli-js/new/server"
11-
"github.com/code-game-project/codegame-cli/cli"
1212
"github.com/spf13/pflag"
1313
)
1414

new/client/client.go

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ import (
55
"os"
66
"path/filepath"
77

8+
"github.com/Bananenpro/cli"
89
"github.com/code-game-project/codegame-cli-js/new"
9-
"github.com/code-game-project/codegame-cli/cli"
1010
"github.com/code-game-project/codegame-cli/util"
1111
)
1212

@@ -17,7 +17,7 @@ var indexJSNode string
1717
var tsConfig []byte
1818

1919
func CreateNewClient(projectName, serverURL, libraryVersion string, typescript bool) error {
20-
cli.Begin("Installing correct javascript-client version...")
20+
cli.BeginLoading("Installing javascript-client...")
2121

2222
var version string
2323
var err error
@@ -35,30 +35,26 @@ func CreateNewClient(projectName, serverURL, libraryVersion string, typescript b
3535
return err
3636
}
3737

38-
cli.Finish()
38+
cli.FinishLoading()
3939

40-
cli.Begin("Creating project template...")
4140
err = createTemplate(projectName, serverURL, typescript)
4241
if err != nil {
4342
return err
4443
}
45-
cli.Finish()
4644

4745
if typescript {
48-
cli.Begin("Installing dependencies...")
46+
cli.BeginLoading("Installing dependencies...")
4947
_, err = util.Execute(true, "npm", "install", "--save-dev", "@types/node")
5048
if err != nil {
5149
return err
5250
}
53-
cli.Finish()
51+
cli.FinishLoading()
5452
}
5553

56-
cli.Begin("Writing configuration files...")
5754
err = new.ConfigurePackageJSON()
5855
if err != nil {
5956
return err
6057
}
61-
cli.Finish()
6258

6359
return nil
6460
}

new/server/server.go

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ import (
44
_ "embed"
55
"os"
66

7+
"github.com/Bananenpro/cli"
78
"github.com/code-game-project/codegame-cli-js/new"
8-
"github.com/code-game-project/codegame-cli/cli"
99
"github.com/code-game-project/codegame-cli/util"
1010
)
1111

@@ -15,7 +15,7 @@ var tsConfig []byte
1515
func CreateNewServer(projectName, libraryVersion string) error {
1616
cli.Warn("This feature is not fully implemented yet.")
1717

18-
cli.Begin("Installing correct javascript-server version...")
18+
cli.BeginLoading("Installing javascript-server...")
1919

2020
var version string
2121
var err error
@@ -33,28 +33,24 @@ func CreateNewServer(projectName, libraryVersion string) error {
3333
return err
3434
}
3535

36-
cli.Finish()
36+
cli.FinishLoading()
3737

38-
cli.Begin("Creating project template...")
3938
err = createTemplate(projectName)
4039
if err != nil {
4140
return err
4241
}
43-
cli.Finish()
4442

45-
cli.Begin("Installing dependencies...")
43+
cli.BeginLoading("Installing dependencies...")
4644
_, err = util.Execute(true, "npm", "install", "--save-dev", "@types/node")
4745
if err != nil {
4846
return err
4947
}
50-
cli.Finish()
48+
cli.FinishLoading()
5149

52-
cli.Begin("Writing configuration files...")
5350
err = new.ConfigurePackageJSON()
5451
if err != nil {
5552
return err
5653
}
57-
cli.Finish()
5854

5955
return nil
6056
}

new/template.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import (
66
"path/filepath"
77
"text/template"
88

9-
"github.com/code-game-project/codegame-cli/cli"
9+
"github.com/Bananenpro/cli"
1010
)
1111

1212
func ExecTemplate(templateText, path string, data any) error {

new/util.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import (
77
"sort"
88
"strings"
99

10-
"github.com/code-game-project/codegame-cli/cli"
10+
"github.com/Bananenpro/cli"
1111
"github.com/code-game-project/codegame-cli/util"
1212
)
1313

0 commit comments

Comments
 (0)