pkg

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2020 License: MIT Imports: 23 Imported by: 1

Documentation

Index

Constants

View Source
const (
	// JSONOutputFormat is the format of json
	JSONOutputFormat string = "json"
	// YAMLOutputFormat is the format of yaml
	YAMLOutputFormat string = "yaml"
	// TableOutputFormat is the format of table
	TableOutputFormat string = "table"
)

Variables

This section is empty.

Functions

func GetJCLIPluginPath

func GetJCLIPluginPath(userHome, name string, binary bool) string

GetJCLIPluginPath returns the path of a jcli plugin

func LoadPlugins

func LoadPlugins(cmd *cobra.Command)

LoadPlugins loads the plugins

func SetProxy

func SetProxy(proxy, proxyAuth string, tr *http.Transport) (err error)

SetProxy set the proxy for a http

Types

type FormatOutput

type FormatOutput interface {
	Output(obj interface{}, format string) (data []byte, err error)
}

FormatOutput is the interface of format output

type HTTPDownloader

type HTTPDownloader struct {
	TargetFilePath     string
	URL                string
	ShowProgress       bool
	InsecureSkipVerify bool

	UserName string
	Password string

	Proxy     string
	ProxyAuth string

	Debug        bool
	RoundTripper http.RoundTripper
}

HTTPDownloader is the downloader for http request

func (*HTTPDownloader) DownloadFile

func (h *HTTPDownloader) DownloadFile() error

DownloadFile download a file with the progress

type OutputOption

type OutputOption struct {
	Format string

	Columns        string
	WithoutHeaders bool
	Filter         []string

	Writer        io.Writer
	CellRenderMap map[string]RenderCell
}

OutputOption represent the format of output

func (*OutputOption) GetLine

func (o *OutputOption) GetLine(obj reflect.Value) []string

GetLine returns the line of a table

func (*OutputOption) ListFilter

func (o *OutputOption) ListFilter(obj interface{}) interface{}

ListFilter filter the data list by fields

func (*OutputOption) Match

func (o *OutputOption) Match(item reflect.Value) bool

Match filter an item

func (*OutputOption) Output

func (o *OutputOption) Output(obj interface{}) (data []byte, err error)

Output print the object into byte array Deprecated see also OutputV2

func (*OutputOption) OutputV2

func (o *OutputOption) OutputV2(obj interface{}) (err error)

OutputV2 print the data line by line

func (*OutputOption) SetFlag

func (o *OutputOption) SetFlag(cmd *cobra.Command)

SetFlag set flag of output format Deprecated, see also SetFlagWithHeaders

func (*OutputOption) SetFlagWithHeaders

func (o *OutputOption) SetFlagWithHeaders(cmd *cobra.Command, headers string)

SetFlagWithHeaders set the flags of output

type Plugin

type Plugin struct {
	Use          string `yaml:"use"`
	Short        string
	Long         string
	Main         string
	Version      string
	DownloadLink string `yaml:"downloadLink"`
	Installed    bool
}

func FindPlugins

func FindPlugins() (plugins []Plugin, err error)

type PluginError

type PluginError struct {
	// contains filtered or unexported fields
}

type ProgressIndicator

type ProgressIndicator struct {
	Writer io.Writer
	Reader io.Reader
	Title  string

	// bytes.Buffer
	Total float64
	// contains filtered or unexported fields
}

ProgressIndicator hold the progress of io operation

func (*ProgressIndicator) Init

func (i *ProgressIndicator) Init()

Init set the default value for progress indicator

func (*ProgressIndicator) Read

func (i *ProgressIndicator) Read(p []byte) (n int, err error)

Read reads the progress

func (*ProgressIndicator) Write

func (i *ProgressIndicator) Write(p []byte) (n int, err error)

Write writes the progress

type RenderCell

type RenderCell = func(string) string

RenderCell render a specific cell in a table

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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