format

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2019 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Overview

Copyright © 2018 Antoine GIRARD <antoine.girard@sapk.fr>

Copyright © 2018 Antoine GIRARD <antoine.girard@sapk.fr>

Copyright © 2018 Antoine GIRARD <antoine.girard@sapk.fr>

Copyright © 2018 Antoine GIRARD <antoine.girard@sapk.fr>

Copyright © 2018 Antoine GIRARD <antoine.girard@sapk.fr>

Copyright © 2018 Antoine GIRARD <antoine.girard@sapk.fr>

Index

Constants

This section is empty.

Variables

View Source
var FormaterList = map[string]Formater{
	"default": Formater{
		func(objType object.Type, obj map[string]interface{}, data map[string][]interface{}) string {
			name := GetFileName(obj)
			ret := "# " + name + "\n"
			ret += "\n"

			ret += dumpAvailableInformation(obj, data) + "\n"
			ret += formatOptions(obj, data)
			ret += formatAnnexes(obj, data)
			ret += dumpBackup(obj)
			return ret
		},
		nil,
		defaultShortFormater,
	},
	"CfgFormat": Formater{
		func(objType object.Type, obj map[string]interface{}, data map[string][]interface{}) string {
			name := GetFileName(obj)
			ret := "# " + name + "\n"
			ret += "\n"

			ret += dumpAvailableInformation(obj, data) + "\n"
			ret += formatFields(obj, data)
			ret += formatOptions(obj, data)
			ret += formatAnnexes(obj, data)
			ret += dumpBackup(obj)
			return ret
		},
		nil,
		defaultShortFormater,
	},
}

Functions

func FormatObj

func FormatObj(objType object.Type, obj map[string]interface{}, data map[string][]interface{}) string

Call the good formatter if exist or use the default

func FormatShortObj

func FormatShortObj(obj map[string]interface{}) string

Call the good formatter if exist or use the default

func GenerateDotGraphByApp

func GenerateDotGraphByApp(data map[string][]interface{}) string

func GenerateDotGraphByHost

func GenerateDotGraphByHost(data map[string][]interface{}) string

func GenerateMermaidGraph

func GenerateMermaidGraph(data map[string][]interface{}) string

func GetFileName

func GetFileName(obj map[string]interface{}) string

Find best suitable name

func GetObjectType

func GetObjectType(obj map[string]interface{}) *object.Type

func Name

func Name(obj map[string]interface{}) string

TODO call this from get Filename

Types

type Formater

type Formater struct {
	Format      func(object.Type, map[string]interface{}, map[string][]interface{}) string
	FormatCSV   func(object.Type, map[string]interface{}, map[string][]interface{}) string
	FormatShort func(object.Type, map[string]interface{}) string
}

Jump to

Keyboard shortcuts

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