state_machine_viz

package
v0.0.11 Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2025 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ColorReset  = "\033[0m"
	ColorGreen  = "\033[32m"
	ColorRed    = "\033[31m"
	ColorGray   = "\033[90m"
	ColorYellow = "\033[33m"
)

Color constants for terminal output

View Source
const (
	SymbolPassed    = "🟢"
	SymbolFailed    = "🔴"
	SymbolUnvisited = "⚪"
	SymbolFailedTx  = "❌"
)

Symbol constants for visualization

Variables

This section is empty.

Functions

func VisualizeStateMachine

func VisualizeStateMachine(
	sm *state_machine.AnyMapStateMachine,
	passedStates []string,
	failedStates []string,
	failedTransition string,
	options VisualizationOptions,
) string

VisualizeStateMachine generates a text-based visualization of a state machine with color-coded states based on their status.

Parameters: - sm: The state machine to visualize - passedStates: Slice of state names that have been successfully traversed - failedStates: Slice of state names that failed during traversal - failedTransition: Optional name of the transition/event that failed - options: Optional visualization options

Returns: - string: A formatted string representation of the state machine diagram

Types

type VisualizationOptions

type VisualizationOptions struct {
	UseUnicode bool // Whether to use Unicode symbols (true) or ASCII (false)
	UseColors  bool // Whether to use ANSI color codes
	Compact    bool // Whether to use a compact representation
}

VisualizationOptions contains configuration options for the visualization

func DefaultOptions

func DefaultOptions() VisualizationOptions

DefaultOptions returns the default visualization options

Jump to

Keyboard shortcuts

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