printer

package
v2.3.1+incompatible Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2018 License: MIT Imports: 17 Imported by: 2

README

madonctl

Golang command line interface for the Mastodon API

license

madonctl is a Go CLI tool to use the Mastondon REST API.

Installation

To install the application (you need to have Go):

go get github.com/McKael/madonctl

Some pre-built binaries are available on the home page (see below).

Usage

This section has not been written yet.

Please check the Homepage for an introduction and a few examples.

References

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type JSONPrinter

type JSONPrinter struct {
}

JSONPrinter represents a JSON printer

func NewPrinterJSON

func NewPrinterJSON(options Options) (*JSONPrinter, error)

NewPrinterJSON returns a JSON ResourcePrinter

func (*JSONPrinter) PrintObj

func (p *JSONPrinter) PrintObj(obj interface{}, w io.Writer, option string) error

PrintObj sends the object as text to the writer If the writer w is nil, standard output will be used. For JSONPrinter, the option parameter is currently not used.

type Options added in v0.6.0

type Options map[string]string

Options contains options used when creating a ResourcePrinter

type PlainPrinter

type PlainPrinter struct {
	Indent      string
	NoSubtitles bool
}

PlainPrinter is the default "plain text" printer

func NewPrinterPlain

func NewPrinterPlain(options Options) (*PlainPrinter, error)

NewPrinterPlain returns a plaintext ResourcePrinter For PlainPrinter, the option parameter contains the indent prefix.

func (*PlainPrinter) PrintObj

func (p *PlainPrinter) PrintObj(obj interface{}, w io.Writer, initialIndent string) error

PrintObj sends the object as text to the writer If the writer w is nil, standard output will be used. For PlainPrinter, the option parameter contains the initial indent.

type ResourcePrinter

type ResourcePrinter interface {
	// PrintObj receives a runtime object, formats it and prints it to a writer.
	PrintObj(interface{}, io.Writer, string) error
}

ResourcePrinter is an interface used to print objects.

func NewPrinter

func NewPrinter(output string, options Options) (ResourcePrinter, error)

NewPrinter returns a ResourcePrinter for the specified kind of output. It returns nil if the output is not supported.

type TemplatePrinter

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

TemplatePrinter represents a Template printer

func NewPrinterTemplate

func NewPrinterTemplate(options Options) (*TemplatePrinter, error)

NewPrinterTemplate returns a Template ResourcePrinter For TemplatePrinter, the options parameter contains the template string. The "color_mode" option defines the color behaviour: it can be "auto" (default), "on" (forced), "off" (disabled).

func (*TemplatePrinter) PrintObj

func (p *TemplatePrinter) PrintObj(obj interface{}, w io.Writer, tmpl string) error

PrintObj sends the object as text to the writer If the writer w is nil, standard output will be used.

type ThemePrinter added in v0.6.0

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

ThemePrinter represents a Theme printer

func NewPrinterTheme added in v0.6.0

func NewPrinterTheme(options Options) (*ThemePrinter, error)

NewPrinterTheme returns a Theme ResourcePrinter For ThemePrinter, the options parameter contains the name of the theme and the template base directory (themes are assumed to be in the "themes" subdirectory). The "color_mode" option defines the color behaviour: it can be "auto" (default), "on" (forced), "off" (disabled).

func (*ThemePrinter) PrintObj added in v0.6.0

func (p *ThemePrinter) PrintObj(obj interface{}, w io.Writer, tmpl string) error

PrintObj sends the object as text to the writer If the writer w is nil, standard output will be used.

type YAMLPrinter

type YAMLPrinter struct {
}

YAMLPrinter represents a YAML printer

func NewPrinterYAML

func NewPrinterYAML(options Options) (*YAMLPrinter, error)

NewPrinterYAML returns a YAML ResourcePrinter

func (*YAMLPrinter) PrintObj

func (p *YAMLPrinter) PrintObj(obj interface{}, w io.Writer, option string) error

PrintObj sends the object as text to the writer If the writer w is nil, standard output will be used. For YAMLPrinter, the option parameter is currently not used.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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