Esempio n. 1
0
// Build the template review request based solely on the parsed flag values.
func buildRequestFromFlags() request.Request {
	var reviewers []string
	if len(*requestReviewers) > 0 {
		for _, reviewer := range strings.Split(*requestReviewers, ",") {
			reviewers = append(reviewers, strings.TrimSpace(reviewer))
		}
	}

	return request.New(reviewers, *requestSource, *requestTarget, *requestMessage)
}
Esempio n. 2
0
// Build the template review request based solely on the parsed flag values.
func buildRequestFromFlags(requester string) (request.Request, error) {
	var reviewers []string
	if len(*requestReviewers) > 0 {
		for _, reviewer := range strings.Split(*requestReviewers, ",") {
			reviewers = append(reviewers, strings.TrimSpace(reviewer))
		}
	}
	if *requestMessageFile != "" && *requestMessage == "" {
		var err error
		*requestMessage, err = input.FromFile(*requestMessageFile)
		if err != nil {
			return request.Request{}, err
		}
	}

	return request.New(requester, reviewers, *requestSource, *requestTarget, *requestMessage), nil
}