File: commands_applications.go

package info (click to toggle)
golang-github-jamesclonk-vultr 2.0.1-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, forky, sid, trixie
  • size: 560 kB
  • sloc: makefile: 35
file content (29 lines) | stat: -rw-r--r-- 535 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
package cmd

import (
	"fmt"
	"log"

	"github.com/jawher/mow.cli"
)

func appList(cmd *cli.Cmd) {
	cmd.Action = func() {
		apps, err := GetClient().GetApplications()
		if err != nil {
			log.Fatal(err)
		}

		if len(apps) == 0 {
			fmt.Println()
			return
		}

		lengths := []int{8, 32, 24, 32, 12}
		tabsPrint(columns{"APPID", "NAME", "SHORT_NAME", "DEPLOY_NAME", "SURCHARGE"}, lengths)
		for _, app := range apps {
			tabsPrint(columns{app.ID, app.Name, app.ShortName, app.DeployName, app.Surcharge}, lengths)
		}
		tabsFlush()
	}
}