func GetCredentialProfileFlags()

in cobra/aid/configure.go [56:115]


func GetCredentialProfileFlags(cmd *cobra.Command) model.CredentialProfile {
	var cp model.CredentialProfile

	profile, err := cmd.Flags().GetString("profile")
	if err != nil {
		logrus.Fatalf("unable to get flag profile\n%v", err)
	}

	if profile != "" {
		cp.Name = profile
	}

	// new profile name replaces current profile name
	newName, err := cmd.Flags().GetString("new-name")
	if err != nil {
		logrus.Fatalf("unable to get flag new-name\n%v", err)
	}

	if newName != "" {
		cp.Name = newName
	}

	description, err := cmd.Flags().GetString("description")
	if err != nil {
		logrus.Fatalf("unable to get flag description\n%v", err)
	}

	if description != "" {
		cp.Description = description
	}

	userToken, err := cmd.Flags().GetString("user-token")
	if err != nil {
		logrus.Fatalf("unable to get flag user-token\n%v", err)
	}

	if userToken != "" {
		cp.UserToken = userToken
	}

	teamToken, err := cmd.Flags().GetString("team-token")
	if err != nil {
		logrus.Fatalf("unable to get flag team-token\n%v", err)
	}

	if teamToken != "" {
		cp.TeamToken = teamToken
	}

	organizationToken, err := cmd.Flags().GetString("organization-token")
	if err != nil {
		logrus.Fatalf("unable to get flag organization-token\n%v", err)
	}

	if organizationToken != "" {
		cp.OrganizationToken = organizationToken
	}

	return cp
}