printer

package
v0.7.1 Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2021 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Print

func Print(g *graph.HierarchicalDigraph, config *PrintConfig) error

Print takes in a PrintConfig struct and dumps the content of a HierarchicalDigraph instance according to parameters.

Types

type ClusterLevel

type ClusterLevel int

Level at which to performing clustering when generating the image of the dependency graph.

const (
	// No clustering. Each node is printed as is.
	Off ClusterLevel = iota
	// Cluster nodes that have the same parent.
	Parent
	// Cluster nodes that all have the same, unique, predecessor in the graph.
	Shared
	// Cluster nodes that all have the same (group of) predecessor(s) in the graph.
	Full
)

type Level

type Level uint8
const (
	LevelModules Level = iota
	LevelPackages
)

type PrintConfig

type PrintConfig struct {
	// Logger that should be used to show progress while printing the Graph.
	Log *logger.Logger

	// Which level of granularity to print the graph at (modules, packages).
	Granularity Level

	// Annotate edges and nodes with their respective versions.
	Annotate bool
	// Path at which the printed version of the Graph should be stored. If set to a nil-string a
	// temporary file will be created.
	OutputPath string
	// Options for generating a visual representation of the Graph. If the field is non-nil, print
	// out an image file using GraphViz, if false print out the graph in DOT format.
	Style *StyleOptions
}

PrintConfig allows for the specification of parameters that should be passed to the Print function of a Graph.

type StyleOptions

type StyleOptions struct {
	// Scale nodes according to the number of their successors and predecssors.
	ScaleNodes bool
	// Level at which to cluster nodes in the printed graph. This can be very beneficial for larger
	// dependency graphs that might be unreadable with the default settings.
	Cluster ClusterLevel
}

Jump to

Keyboard shortcuts

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