Skip to content

Commit

Permalink
CLOUDP-125111: Revert color causing windows issue (#1286)
Browse files Browse the repository at this point in the history
  • Loading branch information
blva committed Jun 3, 2022
1 parent ddcf064 commit 5fedea9
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 11 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ require (
github.com/PaesslerAG/jsonpath v0.1.1
github.com/aws/aws-sdk-go v1.44.24
github.com/briandowns/spinner v1.18.1
github.com/fatih/color v1.13.0
github.com/gemalto/kmip-go v0.0.6-0.20210426170211-84e83580888d
github.com/go-test/deep v1.0.8
github.com/golang-jwt/jwt/v4 v4.4.1
Expand Down Expand Up @@ -53,6 +52,7 @@ require (
github.com/PaesslerAG/gval v1.0.0 // indirect
github.com/ansel1/merry v1.5.1 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/fatih/color v1.13.0 // indirect
github.com/fsnotify/fsnotify v1.5.4 // indirect
github.com/gemalto/flume v0.12.0 // indirect
github.com/go-stack/stack v1.8.0 // indirect
Expand Down
12 changes: 2 additions & 10 deletions internal/cli/auth/login.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import (
"time"

"github.com/AlecAivazis/survey/v2"
"github.com/fatih/color"
"github.com/mongodb/mongodb-atlas-cli/internal/cli"
"github.com/mongodb/mongodb-atlas-cli/internal/cli/require"
"github.com/mongodb/mongodb-atlas-cli/internal/config"
Expand Down Expand Up @@ -204,22 +203,15 @@ To verify your account, copy your one-time verification code:
`)

userCode := fmt.Sprintf("%s-%s", code.UserCode[0:len(code.UserCode)/2], code.UserCode[len(code.UserCode)/2:])
opts.printlnWithColor(color.New(color.FgYellow, color.Bold), userCode)
_, _ = fmt.Fprintln(opts.OutWriter, userCode)

_, _ = fmt.Fprintf(opts.OutWriter, `
Paste the code in the browser when prompted to activate your Atlas CLI. Your code will expire after %.0f minutes.
To continue, go to `,
codeDuration.Minutes(),
)
opts.printlnWithColor(color.New(color.FgBlue, color.Bold), code.VerificationURI)
}

func (opts *LoginOpts) printlnWithColor(c *color.Color, text string) {
_, err := c.Fprintln(opts.OutWriter, text)
if err != nil {
_, _ = fmt.Fprintln(opts.OutWriter, text)
}
_, _ = fmt.Fprintln(opts.OutWriter, code.VerificationURI)
}

func (opts *LoginOpts) handleBrowser(uri string) {
Expand Down

0 comments on commit 5fedea9

Please sign in to comment.