Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/shreifelagamy/state-machine-flow
this is a GO library to generate image for status flow library
https://github.com/shreifelagamy/state-machine-flow
Last synced: about 2 months ago
JSON representation
this is a GO library to generate image for status flow library
- Host: GitHub
- URL: https://github.com/shreifelagamy/state-machine-flow
- Owner: shreifelagamy
- License: mit
- Created: 2024-11-10T13:24:54.000Z (about 2 months ago)
- Default Branch: main
- Last Pushed: 2024-11-10T13:36:18.000Z (about 2 months ago)
- Last Synced: 2024-11-10T14:29:16.529Z (about 2 months ago)
- Language: Go
- Size: 2.93 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Status Flow Generator
A Go-based tool that generates visual status flow diagrams from JSON definitions using Graphviz.
## Prerequisites
- Go 1.x or higher
- Graphviz (must be installed and accessible in PATH)## Installation
1. Clone the repository
2. Ensure Graphviz is installed on your system
3. Build the program: `go build status_flow.go`## Usage
### Command Line Flags
- `-path`: Output directory path (default: current directory)
- `-name`: Base name for output files without extension (default: "status_flow")
- `-static`: Use predefined static data instead of JSON input (default: false)### Input Format
The program accepts JSON input in two ways:
1. Direct JSON string through stdin
2. JSON file input#### JSON Structure
The JSON should be an array of status objects, where each object has:
- `Name`: (string) The name of the status
- `NextStatus`: (array of strings) List of possible next statusesExample JSON structure:
```json
[
{
"Name": "Status A",
"NextStatus": ["Status B", "Status C"]
},
{
"Name": "Status B",
"NextStatus": ["Status C"]
},
{
"Name": "Status C",
"NextStatus": ["Status A"]
}
]
```### Examples
1. Using JSON file input:
```bash
./status_flow -path=./output -name=my_flow < input.json
```2. Using JSON string input:
```bash
echo '[{"Name":"Status A","NextStatus":["Status B","Status C"]},{"Name":"Status B","NextStatus":["Status C"]},{"Name":"Status C","NextStatus":["Status A"]}]' | ./status_flow -path=./output -name=my_flow
```3. Using predefined static data:
```bash
./status_flow -path=./output -name=my_flow -static
```## Output
The program generates two output files:
1. DOT file: Graphviz DOT file used to generate the PNG
2. PNG file: PNG image of the SVG file## License
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details