INNER CODE UNIT · Go

CheckForEmptyArgsAndExit

cyberark/kubeletctl · cmd/print.go:27

func CheckForEmptyArgsAndExit(args []string, message string) {
	if len(args) == 0 {
		fmt.Println(message)
		os.Exit(1)
	}
}

func PrintPods(podList v1.PodList) {
	tw := table.NewWriter()
	tw.AppendHeader(table.Row{"Pod", "Namespace", "Containers"})

	for _, pod := range podList.Items {
		var containersString string
		for _, container := range pod.Spec.Containers {
			containersString += container.Name + "\n"
		}

		tw.AppendRow([]interface{}{pod.Name, pod.Namespace, containersString})

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…