Skip to content

Commit

Permalink
Improve user info messages when signing in or signing up
Browse files Browse the repository at this point in the history
  • Loading branch information
mlejva committed Apr 24, 2020
1 parent 8a51fb9 commit f6e05cf
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 2 deletions.
2 changes: 2 additions & 0 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ func init() {
if cmd != "init" &&
cmd != "sign-out" &&
cmd != "sign-in" &&
cmd != "sign-up" &&
cmd != "env-set" &&
cmd != "env-print" &&
cmd != "--help" {
Expand Down Expand Up @@ -131,6 +132,7 @@ func cobraInitCallback(cmd string) {
if cmd != "init" &&
cmd != "sign-out" &&
cmd != "sign-in" &&
cmd != "sign-up" &&
cmd != "--help" {
logger.Log("\n")
warningText := "You aren't signed in. Some features won't be available! To sign in, run \x1b[1m'foundry sign-in'\x1b[0m or \x1b[1m'foundry sign-up'\x1b[0m to sign up.\nThis message will self-destruct in 5s...\n"
Expand Down
6 changes: 4 additions & 2 deletions cmd/signin.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ var (
qs = []*survey.Question{
{
Name: "email",
Prompt: &survey.Input{Message: "Email:"},
Prompt: &survey.Input{Message: "Foundry email:"},
Validate: survey.Required,
},
{
Name: "pass",
Prompt: &survey.Password{Message: "Password:"},
Prompt: &survey.Password{Message: "Foundry password:"},
Validate: survey.Required,
},
}
Expand All @@ -44,6 +44,8 @@ func runSignIn(cmd *cobra.Command, args []string) {
Pass string `survey:"pass`
}{}

logger.Logln("Sign in to your Foundry account\n")

err := survey.Ask(qs, &creds)
// Without this specific "if" SIGINT (Ctrl+C) would only
// interrupt the survey's prompt and not the whole program
Expand Down
3 changes: 3 additions & 0 deletions cmd/signup.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package cmd

import (
"foundry/cli/logger"
"log"
"os"

Expand Down Expand Up @@ -51,6 +52,8 @@ func runSignUp(cmd *cobra.Command, args []string) {
PassAgain string `survey:"passAgain`
}{}

logger.Logln("Create new Foundry account\n")

// Ask for email
err := survey.Ask(emailQ, &creds)
// Without this specific "if" SIGINT (Ctrl+C) would only
Expand Down
1 change: 1 addition & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,7 @@ github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+
github.com/stretchr/testify v1.2.1/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
github.com/stretchr/testify v1.2.2 h1:bSDNvY7ZPG5RlJ8otE/7V6gMiyenm9RtJ7IUVIAoJ1w=
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk=
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
github.com/subosito/gotenv v1.2.0 h1:Slr1R9HxAlEKefgq5jn9U+DnETlIUa6HfgEzj0g5d7s=
github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw=
Expand Down

0 comments on commit f6e05cf

Please sign in to comment.