File tree 9 files changed +373
-10
lines changed
9 files changed +373
-10
lines changed Original file line number Diff line number Diff line change 1
1
package main
2
2
3
3
import (
4
+ "os"
5
+
4
6
"github.com/netsoc/cli/pkg/cmd"
7
+ "github.com/netsoc/cli/pkg/util"
5
8
)
6
9
7
10
func main () {
8
- cmd .NewCmdRoot ().Execute ()
11
+ if err := cmd .NewCmdRoot ().Execute (); err != nil {
12
+ os .Exit (1 )
13
+ }
14
+
15
+ os .Exit (util .ExitCode )
9
16
}
Original file line number Diff line number Diff line change @@ -16,7 +16,7 @@ require (
16
16
github.com/mitchellh/go-homedir v1.1.0
17
17
github.com/mitchellh/mapstructure v1.3.3
18
18
github.com/netsoc/iam/client v1.0.9
19
- github.com/netsoc/webspaced/client v1.1.0
19
+ github.com/netsoc/webspaced/client v1.1.2
20
20
github.com/skratchdot/open-golang v0.0.0-20200116055534-eef842397966
21
21
github.com/spf13/cobra v1.0.0
22
22
github.com/spf13/pflag v1.0.5
Original file line number Diff line number Diff line change @@ -173,8 +173,8 @@ github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3Rllmb
173
173
github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223 /go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U =
174
174
github.com/netsoc/iam/client v1.0.9 h1:hrOXe0cVYzsvIlkFNUsq98mE7lyZnS7wBnriiUAGAzc =
175
175
github.com/netsoc/iam/client v1.0.9 /go.mod h1:CA6PtAeTRVAx6AXb+DAjav7d754hNWcwEVFij9Nzsxg =
176
- github.com/netsoc/webspaced/client v1.1.0 h1:WmUS4C3ZirHeOvDbLoNIZsAziiR4NnAzCwDZXXWuxXU =
177
- github.com/netsoc/webspaced/client v1.1.0 /go.mod h1:GFCOmONSPqvqD2LoglRBFrqr0GdUbN/7huvbsyXMRkU =
176
+ github.com/netsoc/webspaced/client v1.1.2 h1:j+Sux/iqecUV+Ee/325o28dazWL0a114J3KY3loXkXY =
177
+ github.com/netsoc/webspaced/client v1.1.2 /go.mod h1:GFCOmONSPqvqD2LoglRBFrqr0GdUbN/7huvbsyXMRkU =
178
178
github.com/oklog/ulid v1.3.1 /go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U =
179
179
github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c /go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc =
180
180
github.com/pelletier/go-toml v1.2.0 h1:T5zMGML61Wp+FlcbWjRDT7yAxhJNAiPPLOFECq181zc =
Original file line number Diff line number Diff line change @@ -8,25 +8,23 @@ import (
8
8
"os"
9
9
10
10
"github.com/containerd/console"
11
+ "github.com/gorilla/websocket"
11
12
"github.com/spf13/cobra"
12
13
13
14
"github.com/netsoc/cli/pkg/config"
14
15
"github.com/netsoc/cli/pkg/util"
15
- webspaced "github.com/netsoc/webspaced/client"
16
16
)
17
17
18
18
type consoleOptions struct {
19
- Config func () (* config.Config , error )
20
- WebspacedClient func () (* webspaced.APIClient , error )
19
+ Config func () (* config.Config , error )
21
20
22
21
User string
23
22
}
24
23
25
24
// NewCmdConsole creates a new webspace console command
26
25
func NewCmdConsole (f * util.CmdFactory ) * cobra.Command {
27
26
opts := consoleOptions {
28
- Config : f .Config ,
29
- WebspacedClient : f .WebspacedClient ,
27
+ Config : f .Config ,
30
28
}
31
29
cmd := & cobra.Command {
32
30
Use : "console" ,
@@ -118,6 +116,12 @@ func consoleRun(opts consoleOptions) error {
118
116
fmt .Print ("\r \n " )
119
117
return nil
120
118
case err := <- errChan :
119
+ var ce * websocket.CloseError
120
+ if errors .As (err , & ce ) && ce .Code == websocket .CloseNormalClosure {
121
+ fmt .Print ("\r \n " )
122
+ return nil
123
+ }
124
+
121
125
return err
122
126
}
123
127
}
You can’t perform that action at this time.
0 commit comments