formatters

package
v0.5.4 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2022 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Columns = map[string]Column{
	"file_name": {
		"File Name",
		"File name on disk",
		func(r rom.RomFile) string { return r.File.Name },
	},
	"file_format": {
		"File Format",
		"File format code. One of: z64, v64, n64",
		func(r rom.RomFile) string { return r.File.Format.Code },
	},
	"file_format_desc": {
		"File Format",
		"File format description. example: Big-endian",
		func(r rom.RomFile) string { return r.File.Format.Description },
	},
	"file_size_mbytes": {
		"Size (MB)",
		"File size in megabytes. Always a whole number. example: 32",
		func(r rom.RomFile) string { return fmt.Sprintf("%d", r.File.Size) },
	},
	"file_size_mbits": {
		"Size (Mb)",
		"File size in megabits. Always a whole number. example: 256",
		func(r rom.RomFile) string { return fmt.Sprintf("%d", r.File.Size*8) },
	},
	"file_md5": {
		"MD5",
		"MD5 hash/checksum of the file on disk. Lower-case hexadecimal.",
		func(r rom.RomFile) string { return r.File.MD5 },
	},
	"file_sha1": {
		"SHA1",
		"SHA-1 hash/checksum of the file on disk. Lower-case hexadecimal.",
		func(r rom.RomFile) string { return r.File.SHA1 },
	},
	"file_crc1": {
		"Calculated CRC-1",
		"CRC 1 (CRC HI) calculated from the ROM file.",
		func(r rom.RomFile) string { return r.File.CRC1 },
	},
	"file_crc2": {
		"Calculated CRC-2",
		"CRC 2 (CRC LO) calculated from the ROM file.",
		func(r rom.RomFile) string { return r.File.CRC2 },
	},
	"image_name": {
		"Image Name",
		"Image name / game title embedded in the ROM.",
		func(r rom.RomFile) string { return r.ImageName },
	},
	"version": {
		"Version",
		"Version of the ROM. One of: 1.0, 1.1, 1.2, or 1.3.",
		func(r rom.RomFile) string { return fmt.Sprintf("1.%d", r.Version) },
	},
	"region": {
		"Region",
		"Region description of the ROM derived from the ROM ID.",
		func(r rom.RomFile) string { return r.Region.Description },
	},
	"region_short": {
		"Region",
		"Region short code",
		func(r rom.RomFile) string { return r.Region.Short },
	},
	"video_system": {
		"Video",
		"Video system derived from the ROM region. NTSC or PAL.",
		func(r rom.RomFile) string { return r.Region.VideoSystem },
	},
	"cic": {
		"CIC",
		"CIC chip type. example: 6102",
		func(r rom.RomFile) string { return r.CIC },
	},
	"crc1": {
		"CRC-1",
		"CRC1 checksum of ROM internals. Also known as 'CRC HI'",
		func(r rom.RomFile) string { return r.CRC1 },
	},
	"crc2": {
		"CRC-2",
		"CRC2 checksum of ROM internals. Also known as 'CRC LO'",
		func(r rom.RomFile) string { return r.CRC2 },
	},
	"rom_id": {
		"Rom ID",
		"ROM ID / serial. example: NSME for Super Mario 64 (USA)",
		func(r rom.RomFile) string { return r.Serial() },
	},
}
View Source
var DefaultCsvColumns = []string{
	"file_name", "file_format", "file_size_mbytes",
	"rom_id", "image_name", "version",
	"region", "video_system", "cic", "crc1", "crc2",
}
View Source
var DefaultTableColumns = []string{
	"image_name", "file_format_desc", "file_size_mbytes",
	"rom_id", "version", "region", "video_system",
	"cic", "crc1", "crc2", "file_name",
}
View Source
var OutputFormats = []string{"csv", "tab", "json", "table", "text", "xml"}

Functions

func ColumnHeaders

func ColumnHeaders(column_ids []string) []string

func ColumnHelp

func ColumnHelp() string

func DefaultColumns

func DefaultColumns(outputFormat string) []string

func PluckRomValues

func PluckRomValues(romfile rom.RomFile, column_ids []string) []string

func PrintAll

func PrintAll(items []rom.RomFile, outputFormat string, columns []string) error

func PrintCsv

func PrintCsv(records []rom.RomFile, separator rune, column_ids []string) error

func PrintJson

func PrintJson(data interface{}) error

func PrintOne

func PrintOne(item rom.RomFile, outputFormat string, columns []string) error

func PrintTable

func PrintTable(romfiles []rom.RomFile, column_ids []string) error

func PrintText

func PrintText(info rom.RomFile) error

func PrintXml added in v0.5.1

func PrintXml(records []rom.RomFile) error

func RomsToRecords

func RomsToRecords(romfiles []rom.RomFile, column_ids []string) [][]string

func ValidateColumnIds

func ValidateColumnIds(column_ids []string) (valid []string, invalid []string)

Types

type Column

type Column struct {
	Header      string
	Description string
	Generator   columnValue
}

Jump to

Keyboard shortcuts

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