gofsm

module
v1.8.0 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2021 License: Apache-2.0

README

gofsm

CI License GitHub release codecov Made by Alexey Burmistrov

gofsm is a command line tool that generates finite state machine for Go struct.

Usage

FSM generation
Usage: gofsm gen -p ./examples/transitions -s Order -f State -o order_fsm.go -t ./examples/transitions/transitions.json
   --package, -p      package where struct is located (default: default is current dir(.))
   --struct, -s       struct name
   --field, -f        state field of struct
   --output, -o       output file name (default: default srcdir/<struct>_fsm.go)
   --transitions, -t  path to file with transitions
   --noGenerate, -g   don't put //go:generate instruction to the generated code (default: false)
   --graph-output, -a value  path to transition graph file in dot format

This will generate finite state machine for struct Order with transitions defined in ./examples/transitions/transitions.json file. Transition graph will be generated from transitions file and output will be in dot format

Action generation
Usage: gofsm actions gen --tpl examples/transitions/action.go.tpl -o examples/transitions/actions -t examples/transitions/transitions.json
   --template value, --tpl value  template for action
   --output_dir value, -o value   output dir
   --transitions value, -t value  path to file with transitions

This will generate actions stubs from ./examples/transitions/action.go.tpl file.

Action doc generation
Usage: gofsm actions doc -o examples/transitions/actions/README.md -t examples/transitions/transitions.json
   --output value, -o value       output file name
   --transitions value, -t value  path to file with transitions

This will generate actions doc README.md from transitions file. Further runs of the command will add only new actions and update the Transitions where action appears section.

Install

Using go
go get -u github.com/MrEhbr/gofsm/cmd/gofsm
Download releases

https://github.com/MrEhbr/gofsm/releases

License

© 2020 [Alexey Burmistrov]

Licensed under the Apache License, Version 2.0 (LICENSE). See the COPYRIGHT file for more details.

SPDX-License-Identifier: Apache-2.0

Directories

Path Synopsis
cmd
examples

Jump to

Keyboard shortcuts

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