utils

package
v0.0.0-...-bb29ae1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 8, 2023 License: MIT Imports: 16 Imported by: 0

Documentation

Overview

nolint:deadcode

Index

Constants

This section is empty.

Variables

View Source
var HTTPClient = &http.Client{
	Transport: transport(connTimeout),
	Timeout:   time.Second * time.Duration(defaultTimeout),
}

Functions

func BoolUI

func BoolUI(label string, uiSize int) string

BoolUI output bool ui

func HTTPGet

func HTTPGet(url string) ([]byte, error)

func HTTPPost

func HTTPPost(url, contentType, reqBody string) ([]byte, error)

func HTTPPostWithContext

func HTTPPostWithContext(ctx context.Context, url, contentType, reqBody string) ([]byte, error)

func Hash

func Hash(data string) string

Hash returns the hex form of the sha256 of the argument.

func HashSufString

func HashSufString(data string) string

HashSufString return the string of HashSuf.

func PrintKV

func PrintKV(out io.Writer, prefix string, kv map[string]interface{})

func PrintString

func PrintString(out io.Writer, name string)

func PrintTable

func PrintTable(table interface{}, headers []string) error

PrintTable generate table

func PrintWarning

func PrintWarning(out io.Writer, name string)

func PrintYellow

func PrintYellow(out io.Writer, content string)

func PromptUI

func PromptUI(label string, name string) string

PromptUI output prompt ui

func SelectUI

func SelectUI(kubeItems []Needle, label string, uiSize int) int

SelectUI output select ui

func TimeFormat

func TimeFormat(ts int64) string

Types

type Namespaces

type Namespaces struct {
	Name    string
	Default bool
}

Namespaces namespaces struct

type Needle

type Needle struct {
	Name string
	// Cluster string
	// User    string
	// Center  string
	Desc string
}

Needle use for switch

func ExitOption

func ExitOption(kubeItems []Needle) []Needle

ExitOption exit option of SelectUI

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL