deckformat

package
v0.1.11 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2023 License: Apache-2.0 Imports: 5 Imported by: 1

Documentation

Index

Constants

View Source
const (
	VersionKey   = "_format_version"
	TransformKey = "_transform"
	HistoryKey   = "_ignore" // the top-level key in deck files for storing history info
)

Variables

This section is empty.

Functions

func CompatibleFile

func CompatibleFile(data1 map[string]interface{}, data2 map[string]interface{}) error

CompatibleFile returns nil if the files are compatible. An error otherwise. see CompatibleVersion and CompatibleTransform for what compatibility means.

func CompatibleTransform

func CompatibleTransform(data1 map[string]interface{}, data2 map[string]interface{}) error

CompatibleTransform checks if 2 files are compatible, by '_transform' keys. Returns nil if compatible, and error otherwise.

func CompatibleVersion

func CompatibleVersion(data1 map[string]interface{}, data2 map[string]interface{}) error

CompatibleVersion checks if 2 files are compatible, by '_format_version'. Version is compatible if they are the same major. Missing versions are assumed to be compatible. Returns nil if compatible, and error otherwise.

func HistoryAppend added in v0.1.10

func HistoryAppend(filedata map[string]interface{}, newEntry interface{})

HistoryAppend appends an entry (if non-nil) to the history info array. If there is no array, it will create one.

func HistoryClear added in v0.1.10

func HistoryClear(filedata map[string]interface{})

func HistoryGet added in v0.1.10

func HistoryGet(filedata map[string]interface{}) (historyArray []interface{})

HistoryGet returns a the history info array. If there is none, or if filedata is nil, it will return an empty one.

func HistoryNewEntry added in v0.1.10

func HistoryNewEntry(cmd string) map[string]interface{}

HistoryNewEntry returns a new JSONobject with tool version and command keys set.

func HistorySet added in v0.1.10

func HistorySet(filedata map[string]interface{}, historyArray []interface{})

HistorySet sets the history info array. Setting to nil will delete the history.

func ParseFormatVersion

func ParseFormatVersion(data map[string]interface{}) (int, int, error)

parseFormatVersion parses field `_format_version` and returns major+minor. Field must be present, a string, and have an 'x.y' format. Returns an error otherwise.

func ToolVersionGet added in v0.1.10

func ToolVersionGet() (name string, version string, commit string)

ToolVersionGet returns the individual components of the info

func ToolVersionSet added in v0.1.10

func ToolVersionSet(name string, version string, commit string)

ToolVersionSet can be called once to set the tool info that is reported in the history.

func ToolVersionString added in v0.1.10

func ToolVersionString() string

ToolVersionString returns the info in a single formatted string. eg. "decK 1.2 (123abc)"

Types

This section is empty.

Jump to

Keyboard shortcuts

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