Skip to content
This repository was archived by the owner on Jan 16, 2021. It is now read-only.

Commit 6b38fdf

Browse files
committed
print message about default account key
* print message about default account key the first time it is configured
1 parent 953b35a commit 6b38fdf

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

configure_cmd.go

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package main
33
import (
44
"fmt"
55
"io"
6+
"os"
67

78
"github.com/facebookgo/stackerr"
89
"github.com/spf13/cobra"
@@ -34,7 +35,24 @@ func (c *configureCmd) accountKey(e *env) error {
3435
if c.tokenReader != nil {
3536
l.tokenReader = c.tokenReader
3637
}
37-
foundEmail, creds, _ := l.getTokenCredentials(e, email)
38+
foundEmail, creds, err := l.getTokenCredentials(e, email)
39+
if stackerr.HasUnderlying(err, stackerr.MatcherFunc(os.IsNotExist)) && !c.isDefault {
40+
fmt.Fprintln(
41+
e.Out,
42+
`
43+
44+
Looks like you have not configured the default account key yet.
45+
Note that "parse new" and "parse list" can automatically pick up a default key if present.
46+
Otherwise, you'll have to explicitly set the PARSER_EMAIL environment variable
47+
for it to know which account key to use.
48+
Further, if the command line tool cannot find an account key for a configured email it will try to
49+
use the default account key
50+
51+
To configure the default account key use:
52+
"parse configure accountkey -d"`,
53+
)
54+
}
55+
3856
if creds != nil {
3957
if c.isDefault {
4058
fmt.Fprintln(

0 commit comments

Comments
 (0)