Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( LoginCmd = &cobra.Command{ Use: "login", Short: short, Long: long, Example: example, PreRunE: internal.CheckAPIAndCLIVersion, RunE: func(cmd *cobra.Command, args []string) error { org, err := cmd.Flags().GetString("org") if err != nil { return errors.Wrap(err, "unable to get org flag") } email, err := cmd.Flags().GetString("email") if err != nil { return errors.Wrap(err, "unable to get email flag") } password, err := cmd.Flags().GetString("password") if err != nil { return errors.Wrap(err, "unable to get password flag") } api := common.NewAPI() m := middleware.NewMiddleware(api) session, err := m.Login(email, password) if err != nil { return errors.Wrapf(err, "unable to log user: %s", email) } conf, _ := config.ReadConfig() conf.Token = *session.Token if err := config.WriteConfig(conf); err != nil { return errors.Wrap(err, "unable to save config") } if len(org) != 0 { orgSession, err := m.LoginOrg(org, email, password) if err != nil { return errors.Wrapf(err, "unable to log user: %s", email) } conf, err := config.ReadConfig() if err != nil { return errors.Wrap(err, "unable to read config: %s") } conf.Organizations[org] = config.Organization{ Token: *orgSession.Token, } if err := config.WriteConfig(conf); err != nil { return errors.Wrap(err, "unable to save config") } } return nil }, } )
Functions ¶
This section is empty.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.