update.go 822 B

12345678910111213141516171819202122232425
  1. package user
  2. import (
  3. "github.com/gravitl/netmaker/cli/functions"
  4. "github.com/gravitl/netmaker/models"
  5. "github.com/spf13/cobra"
  6. )
  7. var userUpdateCmd = &cobra.Command{
  8. Use: "update [USER NAME]",
  9. Args: cobra.ExactArgs(1),
  10. Short: "Update a user",
  11. Long: `Update a user`,
  12. Run: func(cmd *cobra.Command, args []string) {
  13. user := &models.User{UserName: args[0], IsAdmin: admin}
  14. functions.PrettyPrint(functions.UpdateUser(user))
  15. },
  16. }
  17. func init() {
  18. userUpdateCmd.Flags().BoolVar(&admin, "admin", false, "Make the user an admin ?")
  19. userUpdateCmd.Flags().StringVar(&networks, "networks", "", "List of networks the user will access to (comma separated)")
  20. userUpdateCmd.Flags().StringVar(&groups, "groups", "", "List of user groups the user will be part of (comma separated)")
  21. rootCmd.AddCommand(userUpdateCmd)
  22. }