diff --git a/.gitignore b/.gitignore index 97e3032..7bf7b4d 100644 --- a/.gitignore +++ b/.gitignore @@ -62,4 +62,4 @@ Temporary Items *.yml dist/ -imscli +/imscli diff --git a/cmd/root.go b/cmd/root.go index 5e4a0ed..dbf1b14 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -11,11 +11,11 @@ package cmd import ( - "os" + "io/ioutil" + "log" "github.com/adobe/imscli/ims" "github.com/spf13/cobra" - "github.com/telegrapher/vrb" ) func RootCmd(version string) *cobra.Command { @@ -29,8 +29,8 @@ func RootCmd(version string) *cobra.Command { Long: `imscli is a CLI tool to automate and troubleshoot Adobe's authentication and authorization service IMS.`, Version: version, PersistentPreRunE: func(cmd *cobra.Command, args []string) error { - if verbose { - vrb.Init(os.Stderr) + if !verbose { + log.SetOutput(ioutil.Discard) } // This call of the initParams will load all env vars, config file and flags. return initParams(cmd, imsConfig, configFile) diff --git a/go.mod b/go.mod index b9af20c..494dd0e 100644 --- a/go.mod +++ b/go.mod @@ -17,5 +17,4 @@ require ( github.com/pkg/browser v0.0.0-20210115035449-ce105d075bb4 github.com/spf13/cobra v1.1.0 github.com/spf13/viper v1.7.1 - github.com/telegrapher/vrb v0.1.0 ) diff --git a/go.sum b/go.sum index f9d285a..70b741c 100644 --- a/go.sum +++ b/go.sum @@ -188,8 +188,6 @@ github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0 github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/subosito/gotenv v1.2.0 h1:Slr1R9HxAlEKefgq5jn9U+DnETlIUa6HfgEzj0g5d7s= github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw= -github.com/telegrapher/vrb v0.1.0 h1:hfguwiwC6SiqRfvlOcQMtHu6bq9zDrNy2zSqYRDWuS8= -github.com/telegrapher/vrb v0.1.0/go.mod h1:i0ygzN6L6mRDCeJoswlKDY5Hkdx6pckcyslJuThu1yE= github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU= go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= diff --git a/ims/authz_user.go b/ims/authz_user.go index 018254a..1782c78 100644 --- a/ims/authz_user.go +++ b/ims/authz_user.go @@ -13,6 +13,7 @@ package ims import ( "context" "fmt" + "log" "net" "net/http" "os" @@ -21,7 +22,6 @@ import ( "github.com/adobe/ims-go/ims" "github.com/adobe/ims-go/login" "github.com/pkg/browser" - "github.com/telegrapher/vrb" ) const port = 8888 @@ -47,7 +47,7 @@ func (i Config) validateAuthorizeUserConfig() error { case i.Organization == "": return fmt.Errorf("missing organization parameter") default: - vrb.Println("all needed parameters verified not empty") + log.Println("all needed parameters verified not empty") } return nil @@ -98,7 +98,7 @@ func (i Config) AuthorizeUser() (string, error) { return "", fmt.Errorf("unable to listen at port %d", port) } - vrb.Println("Local server successfully launched and contacted.") + log.Println("Local server successfully launched and contacted.") localUrl := fmt.Sprintf("http://localhost:%d/", port) @@ -116,9 +116,9 @@ func (i Config) AuthorizeUser() (string, error) { select { case serr = <-server.Error(): - vrb.Println("The IMS HTTP handler returned a message.") + log.Println("The IMS HTTP handler returned a message.") case resp = <-server.Response(): - vrb.Println("The IMS HTTP handler returned a message.") + log.Println("The IMS HTTP handler returned a message.") case <-time.After(time.Minute * 5): fmt.Fprintf(os.Stderr, "Timeout reached waiting for the user to finish the authentication ...\n") serr = fmt.Errorf("user timed out") @@ -127,12 +127,12 @@ func (i Config) AuthorizeUser() (string, error) { if err = server.Shutdown(context.Background()); err != nil { return "", fmt.Errorf("error shutting down the local server: %v", err) } - vrb.Println("Local server shut down ...") + log.Println("Local server shut down ...") if serr != nil { return "", fmt.Errorf("error negotiating the authorization code: %v", serr) } - vrb.Println("No error from Authorization Code handler, server is successfully shut down.") + log.Println("No error from Authorization Code handler, server is successfully shut down.") return resp.AccessToken, nil } diff --git a/ims/profile.go b/ims/profile.go index a3d465f..f0e9bd8 100644 --- a/ims/profile.go +++ b/ims/profile.go @@ -12,9 +12,9 @@ package ims import ( "fmt" + "log" "github.com/adobe/ims-go/ims" - "github.com/telegrapher/vrb" ) func (i Config) validateGetProfileConfig() error { @@ -24,7 +24,7 @@ func (i Config) validateGetProfileConfig() error { case i.URL == "": return fmt.Errorf("missing IMS base URL parameter") default: - vrb.Println("all needed parameters verified not empty") + log.Println("all needed parameters verified not empty") } return nil }