本文整理匯總了Golang中github.com/bitrise-io/bitrise/models.BuildRunResultsModel.OrderedResults方法的典型用法代碼示例。如果您正苦於以下問題:Golang BuildRunResultsModel.OrderedResults方法的具體用法?Golang BuildRunResultsModel.OrderedResults怎麽用?Golang BuildRunResultsModel.OrderedResults使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/bitrise-io/bitrise/models.BuildRunResultsModel
的用法示例。
在下文中一共展示了BuildRunResultsModel.OrderedResults方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: PrintSummary
// PrintSummary ...
func PrintSummary(buildRunResults models.BuildRunResultsModel) {
iconBoxWidth := len(" ")
timeBoxWidth := len(" time (s) ")
titleBoxWidth := stepRunSummaryBoxWidthInChars - 4 - iconBoxWidth - timeBoxWidth
fmt.Println()
fmt.Println()
log.Infof("+%s+", strings.Repeat("-", stepRunSummaryBoxWidthInChars-2))
whitespaceWidth := (stepRunSummaryBoxWidthInChars - 2 - len("bitrise summary")) / 2
log.Infof("|%sbitrise summary%s|", strings.Repeat(" ", whitespaceWidth), strings.Repeat(" ", whitespaceWidth))
log.Infof("+%s+%s+%s+", strings.Repeat("-", iconBoxWidth), strings.Repeat("-", titleBoxWidth), strings.Repeat("-", timeBoxWidth))
whitespaceWidth = stepRunSummaryBoxWidthInChars - len("| | title") - len("| time (s) |")
log.Infof("| | title%s| time (s) |", strings.Repeat(" ", whitespaceWidth))
log.Infof("+%s+%s+%s+", strings.Repeat("-", iconBoxWidth), strings.Repeat("-", titleBoxWidth), strings.Repeat("-", timeBoxWidth))
orderedResults := buildRunResults.OrderedResults()
tmpTime := time.Time{}
for _, stepRunResult := range orderedResults {
tmpTime = tmpTime.Add(stepRunResult.RunTime)
log.Info(stepResultCell(stepRunResult))
}
runtime := tmpTime.Sub(time.Time{})
log.Infof("+%s+", strings.Repeat("-", stepRunSummaryBoxWidthInChars-2))
runtimeStr := TimeToFormattedSeconds(runtime, " sec")
whitespaceWidth = stepRunSummaryBoxWidthInChars - len(fmt.Sprintf("| Total runtime: %s|", runtimeStr))
log.Infof("| Total runtime: %s%s|", runtimeStr, strings.Repeat(" ", whitespaceWidth))
log.Infof("+%s+", strings.Repeat("-", stepRunSummaryBoxWidthInChars-2))
fmt.Println()
}
示例2: PrintSummary
// PrintSummary ...
func PrintSummary(buildRunResults models.BuildRunResultsModel) {
iconBoxWidth := len(" ")
timeBoxWidth := len(" time (s) ")
titleBoxWidth := stepRunSummaryBoxWidthInChars - 4 - iconBoxWidth - timeBoxWidth
fmt.Println()
fmt.Println()
fmt.Printf("+%s+\n", strings.Repeat("-", stepRunSummaryBoxWidthInChars-2))
whitespaceWidth := (stepRunSummaryBoxWidthInChars - 2 - len("bitrise summary ")) / 2
fmt.Printf("|%sbitrise summary %s|\n", strings.Repeat(" ", whitespaceWidth), strings.Repeat(" ", whitespaceWidth))
fmt.Printf("+%s+%s+%s+\n", strings.Repeat("-", iconBoxWidth), strings.Repeat("-", titleBoxWidth), strings.Repeat("-", timeBoxWidth))
whitespaceWidth = stepRunSummaryBoxWidthInChars - len("| | title") - len("| time (s) |")
fmt.Printf("| | title%s| time (s) |\n", strings.Repeat(" ", whitespaceWidth))
fmt.Printf("+%s+%s+%s+\n", strings.Repeat("-", iconBoxWidth), strings.Repeat("-", titleBoxWidth), strings.Repeat("-", timeBoxWidth))
orderedResults := buildRunResults.OrderedResults()
tmpTime := time.Time{}
for _, stepRunResult := range orderedResults {
tmpTime = tmpTime.Add(stepRunResult.RunTime)
fmt.Println(getRunningStepFooterMainSection(stepRunResult))
fmt.Printf("+%s+%s+%s+\n", strings.Repeat("-", iconBoxWidth), strings.Repeat("-", titleBoxWidth), strings.Repeat("-", timeBoxWidth))
if stepRunResult.Error != nil || stepRunResult.StepInfo.GlobalInfo.RemovalDate != "" || isUpdateAvailable(stepRunResult.StepInfo) {
footerSubSection := getRunningStepFooterSubSection(stepRunResult)
if footerSubSection != "" {
fmt.Println(footerSubSection)
fmt.Printf("+%s+%s+%s+\n", strings.Repeat("-", iconBoxWidth), strings.Repeat("-", titleBoxWidth), strings.Repeat("-", timeBoxWidth))
}
}
}
runtime := tmpTime.Sub(time.Time{})
runTimeStr, err := FormattedSecondsToMax8Chars(runtime)
if err != nil {
log.Errorf("Failed to format time, error: %s", err)
runTimeStr = "999+ hour"
}
whitespaceWidth = stepRunSummaryBoxWidthInChars - len(fmt.Sprintf("| Total runtime: %s|", runTimeStr))
if whitespaceWidth < 0 {
log.Errorf("Invalid time box size for RunTime: %#v", runtime)
whitespaceWidth = 0
}
fmt.Printf("| Total runtime: %s%s|\n", runTimeStr, strings.Repeat(" ", whitespaceWidth))
fmt.Printf("+%s+\n", strings.Repeat("-", stepRunSummaryBoxWidthInChars-2))
fmt.Println()
}
示例3: PrintSummary
// PrintSummary ...
func PrintSummary(buildRunResults models.BuildRunResultsModel) {
iconBoxWidth := len(" ")
timeBoxWidth := len(" time (s) ")
titleBoxWidth := stepRunSummaryBoxWidthInChars - 4 - iconBoxWidth - timeBoxWidth
fmt.Println()
fmt.Println()
fmt.Printf("+%s+\n", strings.Repeat("-", stepRunSummaryBoxWidthInChars-2))
whitespaceWidth := (stepRunSummaryBoxWidthInChars - 2 - len("bitrise summary ")) / 2
fmt.Printf("|%sbitrise summary %s|\n", strings.Repeat(" ", whitespaceWidth), strings.Repeat(" ", whitespaceWidth))
fmt.Printf("+%s+%s+%s+\n", strings.Repeat("-", iconBoxWidth), strings.Repeat("-", titleBoxWidth), strings.Repeat("-", timeBoxWidth))
whitespaceWidth = stepRunSummaryBoxWidthInChars - len("| | title") - len("| time (s) |")
fmt.Printf("| | title%s| time (s) |\n", strings.Repeat(" ", whitespaceWidth))
fmt.Printf("+%s+%s+%s+\n", strings.Repeat("-", iconBoxWidth), strings.Repeat("-", titleBoxWidth), strings.Repeat("-", timeBoxWidth))
orderedResults := buildRunResults.OrderedResults()
tmpTime := time.Time{}
for _, stepRunResult := range orderedResults {
tmpTime = tmpTime.Add(stepRunResult.RunTime)
fmt.Println(getRunningStepFooterMainSection(stepRunResult))
fmt.Printf("+%s+%s+%s+\n", strings.Repeat("-", iconBoxWidth), strings.Repeat("-", titleBoxWidth), strings.Repeat("-", timeBoxWidth))
if stepRunResult.Error != nil {
isUpdateAvailable := IsUpdateAvailable(stepRunResult.StepInfo)
footerSubSection := getRunningStepFooterSubSection(stepRunResult, isUpdateAvailable)
if footerSubSection != "" {
fmt.Println(footerSubSection)
fmt.Printf("+%s+%s+%s+\n", strings.Repeat("-", iconBoxWidth), strings.Repeat("-", titleBoxWidth), strings.Repeat("-", timeBoxWidth))
}
}
}
runtime := tmpTime.Sub(time.Time{})
runtimeStr := TimeToFormattedSeconds(runtime, " sec")
whitespaceWidth = stepRunSummaryBoxWidthInChars - len(fmt.Sprintf("| Total runtime: %s|", runtimeStr))
fmt.Printf("| Total runtime: %s%s|\n", runtimeStr, strings.Repeat(" ", whitespaceWidth))
fmt.Printf("+%s+\n", strings.Repeat("-", stepRunSummaryBoxWidthInChars-2))
fmt.Println()
}