cli

package
v0.24.0 Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2025 License: AGPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// EnvServer is the server endpoint the client uses. If not set,
	// clients will use '127.0.0.1:7373'.
	EnvServer = "MINIO_KES_SERVER"

	// EnvAPIKey is used by the client to authenticate to the server.
	EnvAPIKey = "MINIO_KES_API_KEY"

	EnvPrivateKey = "MINIO_KES_KEY_FILE"

	EnvCertificate = "MINIO_KES_CERT_FILE"
)

Environment variable used by the KES CLI.

Variables

This section is empty.

Functions

func Assert added in v0.24.0

func Assert(statement bool, args ...any)

Assert calls Exit if the statement is false.

func Assertf added in v0.24.0

func Assertf(statement bool, format string, args ...any)

Assertf calls Exitf if the statement is false.

func Env added in v0.24.0

func Env(key string) string

Env retrieves the value of the environment variable named by the key. It returns the value, which will be empty if the variable is not present.

func Exit added in v0.24.0

func Exit(args ...any)

Exit prints args as error message and aborts with exit code 1.

func Exitf added in v0.24.0

func Exitf(format string, args ...any)

Exitf formats args as error message and aborts with exit code 1.

func Fatal

func Fatal(v ...any)

Fatal writes an error prefix and the operands to OS stderr. Then, Fatal terminates the program by calling os.Exit(1).

func Fatalf

func Fatalf(format string, v ...any)

Fatalf writes an error prefix and the operands, formatted according to the format specifier, to OS stderr. Then, Fatalf terminates the program by calling os.Exit(1).

func Fg added in v0.24.0

func Fg(c tui.TerminalColor, s ...string) tui.Style

Fg returns a new style with the given foreground color. All strings s are rendered with the style. For example:

fmt.Println(cli.Fg(tui.ANSIColor(2), "Hello World"))

func IsTerminal added in v0.24.0

func IsTerminal() bool

IsTerminal reports whether stdout is a terminal.

func Print added in v0.20.0

func Print(v ...any) (int, error)

Print formats using the default formats for its operands and writes to standard output. Spaces are added between operands when neither is a string. It returns the number of bytes written and any write error encountered.

func Printf added in v0.20.0

func Printf(format string, v ...any) (int, error)

Printf formats according to a format specifier and writes to standard output. It returns the number of bytes written and any write error encountered.

func Println added in v0.20.0

func Println(v ...any) (int, error)

Println formats using the default formats for its operands and writes to standard output. Spaces are always added between operands and a newline is appended. It returns the number of bytes written and any write error encountered.

Types

type Buffer added in v0.23.0

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

A Buffer is used to efficiently build a string to display on a terminal.

func (*Buffer) Sprint added in v0.23.0

func (b *Buffer) Sprint(v ...any) *Buffer

Sprint appends to the Buffer. Arguments are handled in the manner of fmt.Print.

func (*Buffer) Sprintf added in v0.23.0

func (b *Buffer) Sprintf(format string, v ...any) *Buffer

Sprintf appends to the Buffer. Arguments are handled in the manner of fmt.Printf.

func (*Buffer) Sprintln added in v0.23.0

func (b *Buffer) Sprintln(v ...any) *Buffer

Sprintln appends to the Buffer. Arguments are handled in the manner of fmt.Println.

func (*Buffer) String added in v0.23.0

func (b *Buffer) String() string

String returns the accumulated string.

func (*Buffer) Stylef added in v0.23.0

func (b *Buffer) Stylef(style tui.Style, format string, v ...any) *Buffer

Stylef appends the styled string to the Buffer. Arguments are handled in the manner of fmt.Printf before styling.

func (*Buffer) Styleln added in v0.23.0

func (b *Buffer) Styleln(style tui.Style, v ...any) *Buffer

Styleln appends the styled string to the Buffer. Arguments are handled in the manner of fmt.Println before styling.

func (*Buffer) Write added in v0.23.0

func (b *Buffer) Write(p []byte) (int, error)

Write appends the contents of p to b's buffer. Write always returns len(p), nil.

func (*Buffer) WriteByte added in v0.23.0

func (b *Buffer) WriteByte(v byte) error

WriteByte appends the byte c to b's buffer. The returned error is always nil.

func (*Buffer) WriteRune added in v0.23.0

func (b *Buffer) WriteRune(r rune) (int, error)

WriteRune appends the UTF-8 encoding of Unicode code point r to b's buffer. It returns the length of r and a nil error.

func (*Buffer) WriteString added in v0.23.0

func (b *Buffer) WriteString(s string) (int, error)

WriteString appends the contents of s to b's buffer. It returns the length of s and a nil error.

Jump to

Keyboard shortcuts

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