本文整理汇总了Golang中github.com/cloudfoundry-incubator/lattice/ltc/terminal/colors.Yellow函数的典型用法代码示例。如果您正苦于以下问题:Golang Yellow函数的具体用法?Golang Yellow怎么用?Golang Yellow使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Yellow函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: printDistribution
func (factory *AppExaminerCommandFactory) printDistribution() int {
defer factory.ui.Say(cursor.ClearToEndOfDisplay())
cells, err := factory.appExaminer.ListCells()
if err != nil {
factory.ui.Say("Error visualizing: " + err.Error())
factory.ui.Say(cursor.ClearToEndOfLine())
factory.ui.SayNewLine()
return 1
}
for _, cell := range cells {
factory.ui.Say(cell.CellID)
if cell.Missing {
factory.ui.Say(colors.Red("[MISSING]"))
}
factory.ui.Say(": ")
if cell.RunningInstances == 0 && cell.ClaimedInstances == 0 && !cell.Missing {
factory.ui.Say(colors.Red("empty"))
} else {
factory.ui.Say(colors.Green(strings.Repeat("•", cell.RunningInstances)))
factory.ui.Say(colors.Yellow(strings.Repeat("•", cell.ClaimedInstances)))
}
factory.ui.Say(cursor.ClearToEndOfLine())
factory.ui.SayNewLine()
}
return len(cells)
}
开发者ID:Klaudit,项目名称:lattice,代码行数:30,代码来源:app_examiner_command_factory.go
示例2: colorInstances
func colorInstances(appInfo app_examiner.AppInfo) string {
instances := fmt.Sprintf("%d/%d", appInfo.ActualRunningInstances, appInfo.DesiredInstances)
if appInfo.ActualRunningInstances == appInfo.DesiredInstances {
return colors.Green(instances)
} else if appInfo.ActualRunningInstances == 0 {
return colors.Red(instances)
}
return colors.Yellow(instances)
}
开发者ID:Klaudit,项目名称:lattice,代码行数:10,代码来源:app_examiner_command_factory.go
示例3: task
func (factory *TaskExaminerCommandFactory) task(context *cli.Context) {
taskName := context.Args().First()
if taskName == "" {
factory.ui.SayIncorrectUsage("")
factory.exitHandler.Exit(exit_codes.InvalidSyntax)
return
}
taskInfo, err := factory.taskExaminer.TaskStatus(taskName)
if err != nil {
if err.Error() == task_examiner.TaskNotFoundErrorMessage {
factory.ui.Say(colors.Red(fmt.Sprintf("No task '%s' was found", taskName)))
factory.exitHandler.Exit(exit_codes.CommandFailed)
return
}
factory.ui.Say(colors.Red("Error fetching task result: " + err.Error()))
factory.exitHandler.Exit(exit_codes.CommandFailed)
return
}
w := tabwriter.NewWriter(factory.ui, 9, 8, 1, '\t', 0)
fmt.Fprintf(w, "%s\t%s\n", "Task Name", taskInfo.TaskGuid)
fmt.Fprintf(w, "%s\t%s\n", "Cell ID", taskInfo.CellID)
if taskInfo.State == "PENDING" || taskInfo.State == "CLAIMED" || taskInfo.State == "RUNNING" {
fmt.Fprintf(w, "%s\t%s\n", "Status", colors.Yellow(taskInfo.State))
} else if (taskInfo.State == "COMPLETED" || taskInfo.State == "RESOLVING") && !taskInfo.Failed {
fmt.Fprintf(w, "%s\t%s\n", "Status", colors.Green(taskInfo.State))
fmt.Fprintf(w, "%s\t%s\n", "Result", taskInfo.Result)
} else if taskInfo.Failed {
fmt.Fprintf(w, "%s\t%s\n", "Status", colors.Red(taskInfo.State))
fmt.Fprintf(w, "%s\t%s\n", "Failure Reason", taskInfo.FailureReason)
}
w.Flush()
}
开发者ID:rajkumargithub,项目名称:lattice,代码行数:36,代码来源:task_examiner_command_factory.go
示例4:
test_helpers.ExecuteCommandWithArgs(listAppsCommand, []string{})
Expect(outputBuffer).To(test_helpers.Say(colors.Bold("App Name")))
Expect(outputBuffer).To(test_helpers.Say(colors.Bold("Instances")))
Expect(outputBuffer).To(test_helpers.Say(colors.Bold("DiskMB")))
Expect(outputBuffer).To(test_helpers.Say(colors.Bold("MemoryMB")))
Expect(outputBuffer).To(test_helpers.Say(colors.Bold("Route")))
Expect(outputBuffer).To(test_helpers.Say(colors.Bold("process1")))
Expect(outputBuffer).To(test_helpers.Say(colors.Red("0/21")))
Expect(outputBuffer).To(test_helpers.Say(colors.NoColor("100")))
Expect(outputBuffer).To(test_helpers.Say(colors.NoColor("50")))
Expect(outputBuffer).To(test_helpers.Say("alldaylong.com => 54321"))
Expect(outputBuffer).To(test_helpers.Say(colors.Bold("process2")))
Expect(outputBuffer).To(test_helpers.Say(colors.Yellow("9/8")))
Expect(outputBuffer).To(test_helpers.Say(colors.NoColor("400")))
Expect(outputBuffer).To(test_helpers.Say(colors.NoColor("30")))
Expect(outputBuffer).To(test_helpers.Say("never.io => 1234"))
Expect(outputBuffer).To(test_helpers.Say(colors.Bold("process3")))
Expect(outputBuffer).To(test_helpers.Say(colors.Green("5/5")))
Expect(outputBuffer).To(test_helpers.Say(colors.NoColor("600")))
Expect(outputBuffer).To(test_helpers.Say(colors.NoColor("90")))
Expect(outputBuffer).To(test_helpers.Say("allthetime.com => 1234, herewego.org => 1234"))
Expect(outputBuffer).To(test_helpers.Say(colors.Bold("process4")))
Expect(outputBuffer).To(test_helpers.Say(colors.Green("0/0")))
Expect(outputBuffer).To(test_helpers.Say(colors.NoColor("10")))
Expect(outputBuffer).To(test_helpers.Say(colors.NoColor("10")))
开发者ID:Klaudit,项目名称:lattice,代码行数:30,代码来源:app_examiner_command_factory_test.go
示例5: getStyledWriter
func getStyledWriter(prefix string) io.Writer {
return gexec.NewPrefixedWriter(fmt.Sprintf("[%s] ", colors.Yellow(prefix)), GinkgoWriter)
}
开发者ID:rowhit,项目名称:lattice,代码行数:3,代码来源:cluster_test_runner.go
示例6:
})
itShouldNotColorizeWhitespace(colors.Green)
})
Describe("Cyan", func() {
It("adds the cyan color code", func() {
Expect(colors.Cyan("INFO")).To(Equal("\x1b[36mINFO\x1b[0m"))
})
itShouldNotColorizeWhitespace(colors.Cyan)
})
Describe("Yellow", func() {
It("adds the yellow color code", func() {
Expect(colors.Yellow("INFO")).To(Equal("\x1b[33mINFO\x1b[0m"))
})
itShouldNotColorizeWhitespace(colors.Yellow)
})
Describe("Gray", func() {
It("adds the gray color code", func() {
Expect(colors.Gray("INFO")).To(Equal("\x1b[90mINFO\x1b[0m"))
})
itShouldNotColorizeWhitespace(colors.Gray)
})
Describe("Bold", func() {
It("adds the bold color code", func() {
开发者ID:davidwadden,项目名称:lattice-release,代码行数:31,代码来源:colors_test.go
示例7:
State: "PENDING",
CellID: "cell-01",
Failed: false,
FailureReason: "",
Result: "",
}
fakeTaskExaminer.TaskStatusReturns(taskInfo, nil)
test_helpers.ExecuteCommandWithArgs(taskCommand, []string{"boop"})
Expect(outputBuffer).To(test_helpers.Say("Task Name"))
Expect(outputBuffer).To(test_helpers.Say("boop"))
Expect(outputBuffer).To(test_helpers.Say("Cell ID"))
Expect(outputBuffer).To(test_helpers.Say("cell-01"))
Expect(outputBuffer).To(test_helpers.Say("Status"))
Expect(outputBuffer).To(test_helpers.Say(colors.Yellow("PENDING")))
Expect(outputBuffer).NotTo(test_helpers.Say("Result"))
Expect(outputBuffer).NotTo(test_helpers.Say("Failure Reason"))
Expect(fakeTaskExaminer.TaskStatusCallCount()).To(Equal(1))
Expect(fakeTaskExaminer.TaskStatusArgsForCall(0)).To(Equal("boop"))
})
It("displays result for a non-failed completed task", func() {
taskInfo := task_examiner.TaskInfo{
TaskGuid: "boop",
State: "COMPLETED",
CellID: "cell-01",
Failed: false,
FailureReason: "",
Result: "some-result",
开发者ID:shanetreacy,项目名称:lattice,代码行数:31,代码来源:task_examiner_command_factory_test.go
示例8:
terminalUI = terminal.NewUI(nil, outputBuffer, nil)
logReader = fake_log_reader.NewFakeLogReader()
consoleTailedLogsOutputter = console_tailed_logs_outputter.NewConsoleTailedLogsOutputter(terminalUI, logReader)
})
Describe("OutputTailedLogs", func() {
It("Tails logs", func() {
now := time.Now()
logReader.AddLog(buildLogMessage("RTR", "1", now, []byte("First log")))
logReader.AddError(errors.New("First Error"))
go consoleTailedLogsOutputter.OutputTailedLogs("my-app-guid")
Eventually(logReader.GetAppGuid).Should(Equal("my-app-guid"))
logOutputBufferString := fmt.Sprintf("%s [%s|%s] First log\n", colors.Cyan(now.Format("01/02 15:04:05.00")), colors.Yellow("RTR"), colors.Yellow("1"))
Eventually(outputBuffer).Should(test_helpers.Say(logOutputBufferString))
Eventually(outputBuffer).Should(test_helpers.Say("First Error\n"))
})
})
Describe("OutputDebugLogs", func() {
It("tails logs with pretty formatting", func() {
now := time.Now()
logReader.AddLog(buildLogMessage("rep", "cell-1", now, []byte("First log")))
logReader.AddError(errors.New("First Error"))
go consoleTailedLogsOutputter.OutputDebugLogs(true)
Eventually(logReader.GetAppGuid).Should(Equal(reserved_app_ids.LatticeDebugLogStreamAppId))
开发者ID:davidwadden,项目名称:lattice-release,代码行数:30,代码来源:console_tailed_logs_outputter_test.go
示例9:
"github.com/cloudfoundry-incubator/lattice/ltc/app_examiner"
"github.com/cloudfoundry-incubator/lattice/ltc/app_examiner/command_factory/presentation"
"github.com/cloudfoundry-incubator/lattice/ltc/terminal/colors"
"github.com/cloudfoundry-incubator/receptor"
)
var _ = Describe("Presentation", func() {
Describe("ColorInstanceState", func() {
It("colors RUNNING green", func() {
instanceInfo := app_examiner.InstanceInfo{State: string(receptor.ActualLRPStateRunning)}
Expect(presentation.ColorInstanceState(instanceInfo)).To(Equal(colors.Green(string(receptor.ActualLRPStateRunning))))
})
It("colors CLAIMED yellow", func() {
instanceInfo := app_examiner.InstanceInfo{State: string(receptor.ActualLRPStateClaimed)}
Expect(presentation.ColorInstanceState(instanceInfo)).To(Equal(colors.Yellow(string(receptor.ActualLRPStateClaimed))))
})
Context("when there is a placement error", func() {
It("colors UNCLAIMED red", func() {
instanceInfo := app_examiner.InstanceInfo{
State: string(receptor.ActualLRPStateUnclaimed),
PlacementError: "I misplaced my cells. Uh oh.",
}
Expect(presentation.ColorInstanceState(instanceInfo)).To(Equal(colors.Red(string(receptor.ActualLRPStateUnclaimed))))
})
})
Context("when there is not a placement error", func() {
It("colors UNCLAIMED cyan", func() {
开发者ID:davidwadden,项目名称:lattice-release,代码行数:31,代码来源:presentation_test.go
示例10: logCallback
func (ctlo *ConsoleTailedLogsOutputter) logCallback(log *events.LogMessage) {
timeString := time.Unix(0, log.GetTimestamp()).Format("01/02 15:04:05.00")
logOutput := fmt.Sprintf("%s [%s|%s] %s", colors.Cyan(timeString), colors.Yellow(log.GetSourceType()), colors.Yellow(log.GetSourceInstance()), log.GetMessage())
ctlo.outputChan <- logOutput
}
开发者ID:davidwadden,项目名称:lattice-release,代码行数:5,代码来源:console_tailed_logs_outputter.go
注:本文中的github.com/cloudfoundry-incubator/lattice/ltc/terminal/colors.Yellow函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论