alysivji / finite-state-machine

Lightweight, decorator-based Python implementation of a Finite State Machine
MIT License
111 stars 12 forks source link

fsm_draw_state_diagram command #29

Open Ibukun2021 opened 3 years ago

Ibukun2021 commented 3 years ago

Hello,

I am not really clear on the 'fsm_draw_state_diagram' command and how to generate a state diagram after implementing your State Machine code. I am trying to generate a state machine diagram for the code below using your implementation. The comment below from one of the documentations wasn't really clear to me and it reads thus: ................................................................................................................................................................................................................................................................... "State Machine workflows can be visualized using a state diagram. finite-state-machine generates diagrams using Mermaid Markdown syntax, which can be viewed using the Mermaid Live Editor. Use the fsm_draw_state_diagram command and point to State Machine workflow class that inheritences from StateMachine.

class parameter is required

$ fsm_draw_state_diagram --class examples.turnstile:Turnstile

initial_state parameter is optional

$ fsm_draw_state_diagram --class examples.turnstile:Turnstile --initial_state close .................................................................................................................................................................................................................................................................

How do I go about this? I already have my code written up. Just need to finish up with the visualization of the state diagram. Will appreciate any help.

alysivji commented 3 years ago

Have you tried cloning this repo and running the example command from the project root in a virtual environment where finite-state-machine is installed?