// CmdAccept creates an environment from a JSON env spec func CmdAccept(inviteCode string, ii IInvites, ia auth.IAuth, ip prompts.IPrompts) error { user, err := ia.Signin() if err != nil { return err } err = ip.YesNo(fmt.Sprintf("Are you sure you want to accept this org invitation as %s? (y/n) ", user.Email)) if err != nil { return err } orgID, err := ii.Accept(inviteCode) if err != nil { return err } logrus.Printf("Successfully joined organization (%s) as %s\n", orgID, user.Email) return nil }
func CmdLogout(il ILogout, ia auth.IAuth) error { ia.Signout() logrus.Println("You have been logged out") return il.Clear() }