Example #1
0
// Run the authorization wizard, generating a config file in the given data
// directory.
func RunAuthWizard(cfg *config.Config) {
	fmt.Println(messageWelcome)
	fmt.Println(messageAddAccount)
	// readConfig will fail loudly by itself, it doesn't return an error
	readConfig(cfg)
	err := cfg.Save()
	if err != nil {
		logger.F(err)
	}
	// Now display the new config to the user.
	err = cfg.Write(os.Stdout)
	if err != nil {
		logger.F(err)
	}
	fmt.Println("\nConfig written to", cfg.ConfigPath())
}
Example #2
0
func readConfig(cfg *config.Config) {
	cfg.Accounts = []*config.Account{readAccount()}
}