@@ -32,7 +32,7 @@ import (
3232
3333 "github.com/patsoffice/aliasman/internal/cmd"
3434 "github.com/patsoffice/aliasman/internal/email"
35- "github.com/patsoffice/aliasman/internal/util "
35+ "github.com/patsoffice/toolbox "
3636 "github.com/spf13/viper"
3737 "golang.org/x/oauth2"
3838 "golang.org/x/oauth2/google"
@@ -60,7 +60,7 @@ func (cn *ConfigerNewer) getTokenFromWeb(config *oauth2.Config) (*oauth2.Token,
6060
6161 authURL := config .AuthCodeURL ("state-token" , oauth2 .AccessTypeOffline )
6262 msg := "Go to the following link in your browser: \n \n %v\n \n then type the authorization code"
63- authCode := util .GetInputString (scanner , fmt .Sprintf (msg , authURL ), "" )
63+ authCode := toolbox .GetInputString (scanner , fmt .Sprintf (msg , authURL ), "" )
6464
6565 tok , err := config .Exchange (context .TODO (), authCode )
6666 if err != nil {
@@ -97,8 +97,8 @@ func (cn *ConfigerNewer) saveToken(path string, token *oauth2.Token) error {
9797func (cn * ConfigerNewer ) Config () error {
9898 scanner := bufio .NewScanner (os .Stdin )
9999
100- if ok := util .CheckYes (scanner , "Configure gsuite provider" , false ); ok {
101- credentiasPath := util .GetInputString (scanner , "GSuite credential path" , viper .GetString ("gsuite_credentials" ))
100+ if ok := toolbox .CheckYes (scanner , "Configure gsuite provider" , false ); ok {
101+ credentiasPath := toolbox .GetInputString (scanner , "GSuite credential path" , viper .GetString ("gsuite_credentials" ))
102102 b , err := ioutil .ReadFile (credentiasPath )
103103 if err != nil {
104104 return fmt .Errorf ("Unable to read client secret file: %v" , err )
@@ -109,7 +109,7 @@ func (cn *ConfigerNewer) Config() error {
109109 }
110110 viper .Set ("gsuite_credentials," , credentiasPath )
111111
112- tokenPath := util .GetInputString (scanner , "GSuite token path" , viper .GetString ("gsuite_token" ))
112+ tokenPath := toolbox .GetInputString (scanner , "GSuite token path" , viper .GetString ("gsuite_token" ))
113113 if tok , err := cn .tokenFromFile (tokenPath ); err != nil {
114114 cmd .ErrorNoExit (err )
115115 if tok , err = cn .getTokenFromWeb (config ); err != nil {
@@ -121,7 +121,7 @@ func (cn *ConfigerNewer) Config() error {
121121 }
122122 viper .Set ("gsuite_token," , tokenPath )
123123
124- if ok := util .CheckYes (scanner , "Make gsuite the default email provider?" , true ); ok {
124+ if ok := toolbox .CheckYes (scanner , "Make gsuite the default email provider?" , true ); ok {
125125 viper .Set ("email_type" , "gsuite" )
126126 }
127127 }
0 commit comments