@@ -11,26 +11,19 @@ type configureCmd struct {
1111 login login
1212}
1313
14- func (c * configureCmd ) accessToken (e * env ) error {
15- fmt .Fprintf (e .Out ,
16- `Please enter an access token if you already generated it.
17-
18- If you do not have an access token or would like to generate a new one,
19- please type: "y" to open the browser or "n" to continue: ` ,
20- )
21-
22- c .login .helpCreateToken (e )
23-
24- var credentials credentials
25- fmt .Fprintf (e .Out , "Access Token: " )
26- fmt .Fscanf (e .In , "%s\n " , & credentials .token )
14+ func (c * configureCmd ) accountKey (e * env ) error {
15+ token , err := c .login .helpCreateToken (e )
16+ if err != nil {
17+ return err
18+ }
2719
28- _ , err := (& apps {login : login {credentials : credentials }}).restFetchApps (e )
20+ credentials := credentials {token : token }
21+ _ , err = (& apps {login : login {credentials : credentials }}).restFetchApps (e )
2922 if err != nil {
3023 if err == errAuth {
3124 fmt .Fprintf (e .Err ,
32- `Sorry, the access token you provided is not valid.
33- Please follow instructions at %s to generate a new access token .
25+ `Sorry, the account key you provided is not valid.
26+ Please follow instructions at %s to generate a new account key .
3427` ,
3528 keysURL ,
3629 )
@@ -53,16 +46,17 @@ func newConfigureCmd(e *env) *cobra.Command {
5346 cmd := & cobra.Command {
5447 Use : "configure" ,
5548 Short : "Configure various Parse settings" ,
56- Long : "Configure various Parse settings like access tokens , project type, and more." ,
49+ Long : "Configure various Parse settings like account keys , project type, and more." ,
5750 Run : func (c * cobra.Command , args []string ) {
5851 c .Help ()
5952 },
6053 }
6154 cmd .AddCommand (& cobra.Command {
62- Use : "token" ,
63- Short : "Store Parse access token on machine" ,
64- Long : "Stores Parse access token in ~/.parse/netrc." ,
65- Run : runNoArgs (e , c .accessToken ),
55+ Use : "accountkey" ,
56+ Short : "Store Parse account key on machine" ,
57+ Long : "Stores Parse account key in ~/.parse/netrc." ,
58+ Run : runNoArgs (e , c .accountKey ),
59+ Aliases : []string {"key" },
6660 })
6761 return cmd
6862}
0 commit comments