cmdutil

package
v0.0.0-...-1fa5987 Latest Latest
Warning

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

Go to latest
Published: May 14, 2022 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ArgToJsonEntry

func ArgToJsonEntry(arg string) (k string, v any, err error)

func ArgsToJsonObject

func ArgsToJsonObject(args []string) (map[string]any, error)

func Fatal

func Fatal(err error)

func Fatalf

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

TODO: Many usages of this should panic, not hard-exit.

func FormatBytes

func FormatBytes(bytes uint64) string

func GetAddr

func GetAddr(cfg *config.Config) string

func ListenAndServe

func ListenAndServe(ctx context.Context, svr *http.Server)

func MustGetwd

func MustGetwd() string

func PrintCueStruct

func PrintCueStruct(v any)

func Serve

func Serve(ctx context.Context, l net.Listener, svr *http.Server)

func Show

func Show(s string)

Print a string with a trailing newline. Avoid printing an _extra_ newline.

func ShutdownOnInterrupt

func ShutdownOnInterrupt(ctx context.Context, svr *http.Server)

func Warnf

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

Types

type ParsedArgs

type ParsedArgs struct {
	Command string
	Args    []string
	Flags   map[string]string
}

func ParseArgs

func ParseArgs(args []string) (*ParsedArgs, error)

func (*ParsedArgs) Dump

func (pa *ParsedArgs) Dump() string

type TableWriter

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

func NewTableWriter

func NewTableWriter(columns ...string) *TableWriter

func (*TableWriter) Flush

func (w *TableWriter) Flush()

func (*TableWriter) WriteRow

func (w *TableWriter) WriteRow(values ...string)

Jump to

Keyboard shortcuts

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