cli

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Dec 24, 2020 License: BSD-2-Clause Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultFormatter is the name of the fallback Formatter
	DefaultFormatter = media.DefaultType
)

Variables

This section is empty.

Functions

This section is empty.

Types

type CLI

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

CLI is a user interface built for the command-line.

func New

func New() *CLI

New creates CLI User Interface with default values

func NewFromConfig added in v0.3.2

func NewFromConfig(cfg *Config) (*CLI, error)

NewFromConfig creates a CLI User Interface from a given Config

func (*CLI) Edit

func (ui *CLI) Edit(m []map[string]interface{}) ([]map[string]interface{}, error)

Edit fires-up a new editor to modify a slice of maps

func (*CLI) Merge

func (ui *CLI) Merge(m, n map[string]interface{}) (map[string]interface{}, error)

Merge spawns an editor that displays two maps and highlight their diff to facilitate change inspection and merge operation between them.

func (*CLI) PrettyDiff

func (ui *CLI) PrettyDiff(mediaL, mediaR map[string]interface{})

PrettyDiff shows in a pleasant manner differences between two metadata sets

func (*CLI) PrettyPrint

func (ui *CLI) PrettyPrint(medias ...map[string]interface{})

PrettyPrint shows in a pleasant manner a metadata set

func (*CLI) Printf

func (ui *CLI) Printf(format string, a ...interface{})

Printf displays a message to the user (has same behaviour than fmt.Printf)

type Config

type Config struct {

	// Auto is the flag that switches between automatic or manual actions when
	// editing or merging records' attributes
	Auto bool

	// OutputFormat selects the style of output to format records when printing
	// them.
	OutputFormat string

	// Formatters contains the list of templates to display information from
	// the store. Templates are organized by output style
	Formatters map[string]map[string]string
	// contains filtered or unexported fields
}

Config describes configuration for User Interface

func NewConfig added in v0.3.3

func NewConfig() *Config

NewConfig creates a new Config

func (*Config) Styles added in v0.5.0

func (cfg *Config) Styles() (styles []string)

Styles lists available styles for printing records.

Jump to

Keyboard shortcuts

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