コード例 #1
0
ファイル: render.go プロジェクト: ErezHorev/dry
//Write sends dry output to the given writer
func Write(d *Dry, w io.Writer) {
	switch d.viewMode() {
	case StatsMode:
		{
			if d.stats != nil {
				io.WriteString(w, appui.NewDockerStatsRenderer(d.stats).Render())
			} else {
				io.WriteString(w, "Could not read stats")
			}
		}
	case ImageHistoryMode:
		io.WriteString(w, appui.NewDockerImageHistoryRenderer(d.imageHistory).Render())
	case InspectMode:
		io.WriteString(w, appui.NewDockerInspectRenderer(d.inspectedContainer).Render())
	case InspectImageMode:
		io.WriteString(w, appui.NewDockerInspectImageRenderer(d.inspectedImage).Render())
	case InspectNetworkMode:
		io.WriteString(w, appui.NewDockerInspectNetworkRenderer(d.inspectedNetwork).Render())
	case HelpMode:
		io.WriteString(w, help)
	case InfoMode:
		io.WriteString(w, appui.NewDockerInfoRenderer(d.info).Render())
	default:
		{
			io.WriteString(w, "Dry is not ready yet for rendering, be patient...")
		}
	}
}
コード例 #2
0
ファイル: render.go プロジェクト: hako/dry
//Write sends dry output to the given writer
func Write(d *Dry, w io.Writer) {
	switch d.State.viewMode {
	case StatsMode:
		{
			if d.stats != nil {
				fmt.Fprintf(w, appui.NewDockerStatsRenderer(d.stats).Render())
			} else {
				fmt.Fprintf(w, "Could not read stats")
			}
		}
	case InspectMode:
		{
			fmt.Fprintf(w, appui.NewDockerInspectRenderer(d.containerToInspect).Render())
		}
	case HelpMode:
		{
			fmt.Fprintf(w, help)
		}

	case InfoMode:
		fmt.Fprintf(w, appui.NewDockerInfoRenderer(d.info).Render())
	default:
		{
			fmt.Fprintf(w, "Dry is not ready yet for rendering, be patient...")
		}
	}
}