本文整理匯總了Golang中github.com/google/git-appraise/review.Review.PrintJson方法的典型用法代碼示例。如果您正苦於以下問題:Golang Review.PrintJson方法的具體用法?Golang Review.PrintJson怎麽用?Golang Review.PrintJson使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/google/git-appraise/review.Review
的用法示例。
在下文中一共展示了Review.PrintJson方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: showReview
// showReview prints the current code review.
func showReview(args []string) error {
showFlagSet.Parse(args)
args = showFlagSet.Args()
var r *review.Review
var err error
if len(args) > 1 {
return errors.New("Only showing a single review is supported.")
}
if len(args) == 1 {
r = review.Get(args[0])
} else {
r, err = review.GetCurrent()
}
if err != nil {
return fmt.Errorf("Failed to load the review: %v\n", err)
}
if r == nil {
return errors.New("There is no matching review.")
}
if *showJsonOutput {
return r.PrintJson()
}
return r.PrintDetails()
}
示例2: showReview
// showReview prints the current code review.
func showReview(repo repository.Repo, args []string) error {
showFlagSet.Parse(args)
args = showFlagSet.Args()
if *showDiffOptions != "" && !*showDiffOutput {
return errors.New("The --diff-opts flag can only be used if the --diff flag is set.")
}
var r *review.Review
var err error
if len(args) > 1 {
return errors.New("Only showing a single review is supported.")
}
if len(args) == 1 {
r = review.Get(repo, args[0])
} else {
r, err = review.GetCurrent(repo)
}
if err != nil {
return fmt.Errorf("Failed to load the review: %v\n", err)
}
if r == nil {
return errors.New("There is no matching review.")
}
if *showJsonOutput {
return r.PrintJson()
}
if *showDiffOutput {
var diffArgs []string
if *showDiffOptions != "" {
diffArgs = strings.Split(*showDiffOptions, ",")
}
return r.PrintDiff(diffArgs...)
}
return r.PrintDetails()
}