diff options
| author | jwijenbergh <jeroenwijenbergh@protonmail.com> | 2022-09-20 13:21:34 +0200 |
|---|---|---|
| committer | jwijenbergh <jeroenwijenbergh@protonmail.com> | 2022-09-20 13:21:34 +0200 |
| commit | 25d2143a627531fc0475d639c1e8f657ccafa630 (patch) | |
| tree | 3b5b69b64f5f6879810842464056543e315c64a4 /cmd/cli | |
| parent | b0e4e454fc94935cf8ee3282a07596ec53268a18 (diff) | |
Golang-ci-lint: Fixes
Diffstat (limited to 'cmd/cli')
| -rw-r--r-- | cmd/cli/main.go | 28 |
1 files changed, 10 insertions, 18 deletions
diff --git a/cmd/cli/main.go b/cmd/cli/main.go index fe6b40e..caeef1c 100644 --- a/cmd/cli/main.go +++ b/cmd/cli/main.go @@ -6,7 +6,7 @@ import ( "os/exec" "strings" - "github.com/jwijenbergh/eduvpn-common" + eduvpn "github.com/jwijenbergh/eduvpn-common" "github.com/jwijenbergh/eduvpn-common/internal/server" ) @@ -27,22 +27,10 @@ func openBrowser(url interface{}) { } fmt.Printf("OAuth: Initialized with AuthURL %s\n", urlString) fmt.Println("OAuth: Opening browser with xdg-open...") - exec.Command("xdg-open", urlString).Start() -} - -// Taken from internal/server.go as it's an internal API for now -// These are used to parse the profile info -type ServerProfile struct { - ID string `json:"profile_id"` - DisplayName string `json:"display_name"` - VPNProtoList []string `json:"vpn_proto_list"` - DefaultGateway bool `json:"default_gateway"` -} -type ServerProfileInfo struct { - Current string `json:"current_profile"` - Info struct { - ProfileList []ServerProfile `json:"profile_list"` - } `json:"info"` + cmdErr := exec.Command("xdg-open", urlString).Start() + if cmdErr != nil { + fmt.Println("OAuth: Browser opened with xdg-open...") + } } // Ask for a profile in the command line @@ -120,7 +108,7 @@ func getConfig(state *eduvpn.VPNState, url string, serverType ServerTypes) (stri func printConfig(url string, serverType ServerTypes) { state := &eduvpn.VPNState{} - state.Register( + registerErr := state.Register( "org.eduvpn.app.linux", "configs", func(old eduvpn.FSMStateID, new eduvpn.FSMStateID, data interface{}) { @@ -128,6 +116,10 @@ func printConfig(url string, serverType ServerTypes) { }, true, ) + if registerErr != nil { + fmt.Printf("Register error: %v", registerErr) + return + } defer state.Deregister() |
