print

package
v1.7.3 Latest Latest
Warning

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

Go to latest
Published: Jan 24, 2025 License: Apache-2.0 Imports: 33 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidPrintOutputMode = fmt.Errorf("not a valid PrintOutputMode, try [%s]", strings.Join(_PrintOutputModeNames, ", "))

Functions

func NewToolsPrintCmd

func NewToolsPrintCmd[B firecore.Block](chain *firecore.Chain[B], logger *zap.Logger) *cobra.Command

func PrintOutputModeNames

func PrintOutputModeNames() []string

PrintOutputModeNames returns a list of possible string values of PrintOutputMode.

Types

type BytesOutputPrinter added in v1.7.2

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

func NewBytesOutputPrinter added in v1.7.2

func NewBytesOutputPrinter(bytesEncoding string, registry *fcproto.Registry) *BytesOutputPrinter

func (*BytesOutputPrinter) PrintTo added in v1.7.2

func (p *BytesOutputPrinter) PrintTo(input any, out io.Writer) error

type JSONOutputPrinter added in v1.6.9

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

func (*JSONOutputPrinter) PrintTo added in v1.6.9

func (p *JSONOutputPrinter) PrintTo(input any, w io.Writer) error

type OutputPrinter added in v1.6.9

type OutputPrinter interface {
	PrintTo(message any, w io.Writer) error
}

func GetOutputPrinter added in v1.6.9

func GetOutputPrinter(cmd *cobra.Command, chainFileDescriptor protoreflect.FileDescriptor) (OutputPrinter, error)

func NewJSONOutputPrinter added in v1.6.9

func NewJSONOutputPrinter(bytesEncoding string, singleLine bool, registry *fcproto.Registry) (OutputPrinter, error)

type PrintOutputMode

type PrintOutputMode uint

ENUM(Text, JSON, JSONL, ProtoJSON, ProtoJSONL, Bytes)

const (
	// PrintOutputModeText is a PrintOutputMode of type Text.
	PrintOutputModeText PrintOutputMode = iota
	// PrintOutputModeJSON is a PrintOutputMode of type JSON.
	PrintOutputModeJSON
	// PrintOutputModeJSONL is a PrintOutputMode of type JSONL.
	PrintOutputModeJSONL
	// PrintOutputModeProtoJSON is a PrintOutputMode of type ProtoJSON.
	PrintOutputModeProtoJSON
	// PrintOutputModeProtoJSONL is a PrintOutputMode of type ProtoJSONL.
	PrintOutputModeProtoJSONL
	// PrintOutputModeBytes is a PrintOutputMode of type Bytes.
	PrintOutputModeBytes
)

func ParsePrintOutputMode

func ParsePrintOutputMode(name string) (PrintOutputMode, error)

ParsePrintOutputMode attempts to convert a string to a PrintOutputMode.

func (PrintOutputMode) IsValid

func (x PrintOutputMode) IsValid() bool

IsValid provides a quick way to determine if the typed value is part of the allowed enumerated values

func (PrintOutputMode) MarshalText

func (x PrintOutputMode) MarshalText() ([]byte, error)

MarshalText implements the text marshaller method.

func (PrintOutputMode) String

func (x PrintOutputMode) String() string

String implements the Stringer interface.

func (*PrintOutputMode) UnmarshalText

func (x *PrintOutputMode) UnmarshalText(text []byte) error

UnmarshalText implements the text unmarshaller method.

type ProtoJSONOutputPrinter added in v1.6.9

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

func NewProtoJSONOutputPrinter added in v1.6.9

func NewProtoJSONOutputPrinter(indent string, registry *fcproto.Registry) *ProtoJSONOutputPrinter

func (*ProtoJSONOutputPrinter) PrintTo added in v1.6.9

func (p *ProtoJSONOutputPrinter) PrintTo(input any, w io.Writer) error

type TextOutputPrinter added in v1.6.9

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

func NewTextOutputPrinter added in v1.6.9

func NewTextOutputPrinter(bytesEncoding string, registry *fcproto.Registry, printTransactions bool) *TextOutputPrinter

func (*TextOutputPrinter) PrintTo added in v1.6.9

func (p *TextOutputPrinter) PrintTo(input any, out io.Writer) error

Jump to

Keyboard shortcuts

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