File: commands_os.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-- 485 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 osList(cmd *cli.Cmd) {
	cmd.Action = func() {
		os, err := GetClient().GetOS()
		if err != nil {
			log.Fatal(err)
		}

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

		lengths := []int{8, 32, 8, 16, 8}
		tabsPrint(columns{"OSID", "NAME", "ARCH", "FAMILY", "WINDOWS"}, lengths)
		for _, os := range os {
			tabsPrint(columns{os.ID, os.Name, os.Arch, os.Family, os.Windows}, lengths)
		}
		tabsFlush()
	}
}