finite-state-machine icon indicating copy to clipboard operation
finite-state-machine copied to clipboard

fsm_draw_state_diagram command

Open Ibukun2021 opened this issue 3 years ago • 1 comments

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.

Ibukun2021 avatar Apr 10 '21 04:04 Ibukun2021

  • command is fsm_draw_state_diagram
  • class option refers to the full dotted path (project.module:ClassName) where the State Machine can be found
  • initial_state is optional -- can be used to specify the initial state of the FSM

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?

alysivji avatar Apr 28 '21 12:04 alysivji