Ejemplo n.º 1
0
func (a Applications) ToColumns(output io.Writer) error {
	w := cli.NewTabWriter(output)
	fmt.Fprintln(w, "\nID\tINSTANCES\tCPU\tMEM\tPORTS\tCONTAINER")
	for _, e := range a.Apps {
		var container string
		if e.Container != nil && e.Container.Docker != nil {
			container = e.Container.Docker.Image
		}
		fmt.Fprintf(w, "%s\t%d\t%.2f\t%.2f\t%s\t%s\n", e.ID, e.Instances, e.CPUs, e.Mem, utils.ConcatInts(e.Ports), container)
	}
	cli.FlushWriter(w)
	return nil
}
Ejemplo n.º 2
0
func (t Task) ToColumns(output io.Writer) error {
	w := cli.NewTabWriter(output)

	fmt.Fprintf(w, OBJ_FMT, "ID", t.ID)
	fmt.Fprintf(w, OBJ_FMT, "AppID", t.AppID)
	fmt.Fprintf(w, OBJ_FMT, "Version", t.Version)
	fmt.Fprintf(w, OBJ_FMT, "Staged", cli.FormatDate(t.StagedAt))
	fmt.Fprintf(w, OBJ_FMT, "Started", cli.FormatDate(t.StartedAt))
	fmt.Fprintf(w, OBJ_FMT, "Host", t.Host)
	fmt.Fprintf(w, OBJ_FMT, "Ports", utils.ConcatInts(t.Ports))

	cli.FlushWriter(w)
	return nil
}
Ejemplo n.º 3
0
func (a Application) ToColumns(output io.Writer) error {
	w := cli.NewTabWriter(output)
	fmt.Fprintln(w, "")
	fmt.Fprintf(w, OBJ_FMT, "ID", a.ID)
	fmt.Fprintf(w, OBJ_FLFMT, "CPUs", a.CPUs)
	fmt.Fprintf(w, OBJ_FLFMT, "Memory", a.Mem)
	fmt.Fprintf(w, OBJ_FMT, "Ports", utils.ConcatInts(a.Ports))
	fmt.Fprintf(w, OBJ_FMT, "Instances", strconv.Itoa(a.Instances))
	fmt.Fprintf(w, OBJ_KVFMT, "Tasks", "Staged", strconv.Itoa(a.TasksStaged))
	fmt.Fprintf(w, OBJ_VAL_KVFMT, "Running", strconv.Itoa(a.TasksRunning))
	fmt.Fprintf(w, OBJ_VAL_KVFMT, "Healthy", strconv.Itoa(a.TasksHealthy))
	fmt.Fprintf(w, OBJ_VAL_KVFMT, "UnHealthy", strconv.Itoa(a.TasksUnHealthy))
	fmt.Fprintln(w, "")
	if a.Container != nil && a.Container.Docker != nil {
		fmt.Fprintf(w, OBJ_KVFMT, "Container", "Type", "Docker")
		fmt.Fprintf(w, OBJ_VAL_KVFMT, "Image", a.Container.Docker.Image)
		fmt.Fprintf(w, OBJ_VAL_KVFMT, "Network", a.Container.Docker.Network)
		fmt.Fprintln(w, "")
	}

	writeMapColumn(w, "Environment", a.Env)
	cli.FlushWriter(w)
	return nil
}