Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var Inherits = []string{
"basic", "connected", "disposed", "rpc/statesrc", "node/worker",
}
TODO enum, merge with schema.go
Functions ¶
This section is empty.
Types ¶
type Args ¶ added in v0.18.4
type Args struct {
Starter *StarterParams `arg:"subcommand:starter-kit" help:"Generate a starter project from schema.yml / mach.yml"`
Schema *SchemaParams `arg:"subcommand:schema" help:"Generate state schema from CLI params"`
SchemaFile *SchemaFileParams `arg:"subcommand:schema-from-file" help:"Generate state schema from schema.yml / mach.yml"`
Grafana *GrafanaParams `arg:"subcommand:grafana" help:"Generate Grafana dashboards"`
Lint *LintParams `arg:"subcommand:lint" help:"Order Schema entries according to StatesDef and add missing ones"`
Version bool `arg:"-v,--version" help:"Print version and exit"`
StatesFile *SchemaParams `arg:"subcommand:states-file" help:"Deprecated, use schema"`
}
Args is the top-level args struct for am-gen.
func (Args) Description ¶ added in v0.18.4
Description returns the formatted CLI description and examples.
type GrafanaParams ¶
type GrafanaParams struct {
Ids string `arg:"-i,--ids,required" help:"Machine IDs (comma separated)"`
GrafanaUrl string `arg:"-g,--grafana-url" help:"Grafana URL to sync. Requires GRAFANA_TOKEN in CWD/.env"`
Folder string `arg:"-f,--folder" help:"Dashboard folder (optional, requires --grafana-url)"`
Name string `arg:"-n,--name,required" help:"Dashboard name"`
Source string `arg:"-s,--source,required" help:"$source variable (service_name or job)"`
Token string `arg:"-"`
}
GrafanaParams are params for the grafana subcommand.
type LintParams ¶ added in v0.19.6
type LintParams struct {
// File - Path to a ss_*.go file or a directory of ss_*.go files.
// Defaults to the current directory.
File string `arg:"positional" help:"Path to a ss_*.go file or a directory (default: CWD)"`
// DryRun - Print the result to stdout instead of writing the file.
DryRun bool `arg:"-d,--dry-run" help:"Print the result to stdout without writing the file"`
}
LintParams are params for the lint subcommand.
type SchemaFileParams ¶ added in v0.19.3
type SchemaFileParams struct {
SchemaParamsCommon
// File - Path to YAML schema file.
File string `arg:"positional,required" help:"Path to schema.yml / mach.yml"`
// internal
FileContent []byte `arg:"-"`
}
SchemaFileParams are params for the schema-yaml subcommand.
type SchemaParams ¶ added in v0.19.3
type SchemaParams struct {
SchemaParamsCommon
// State - State name to generate (repeatable). Eg: --state State1 --state State2:multi
State []string `arg:"--state,separate" help:"Repeatable state name to generate. Eg: --state State1 --state State2:multi"`
// States - State names to generate. Eg: State1,State2
States string `arg:"-s,--states" help:"State names to generate. Eg: State1,State2"`
}
SchemaParams are params for the states-file subcommand.
type SchemaParamsCommon ¶ added in v0.19.3
type SchemaParamsCommon struct {
// Version - print version
Version bool
// Inherit - Inherit from built-in states machines (comma separated or repeatable):
// - basic,connected
// - rpc/statesrc
// - node/worker
Inherit []string `arg:"-i,--inherit,separate" help:"Inherit from built-in state-machines: basic,disposed,connected,rpc/statesrc,node/worker"`
// Group - Group to generate (repeatable). Eg: --group Group1 --group Group2
Group []string `arg:"--group,separate" help:"Repeatable group to generate. Eg: --group Group1 --group Group2"`
// Groups - Groups to generate. Eg: Group1,Group2
Groups string `arg:"-g,--groups" help:"Groups to generate. Eg: Group1,Group2"`
// Name - Name of the state machine.
Name string `arg:"-n,--name" default:"MyMach" help:"Name of the state machine. Eg: MyMach"`
// Force - Overwrite existing files.
Force bool `arg:"-f,--force" help:"Override output file (if any)"`
// Utils - Generate states_utils.go in CWD. Overrides files.
Utils bool `arg:"-u,--utils" default:"true" help:"Generate states_utils.go in CWD. Overrides files."`
// Global - Import pkg/states/global and skip generating states_utils.go.
Global bool `arg:"--global" default:"true" help:"Import pkg/states/global and skip generating states_utils.go"`
// Output - Print output to stdout instead of writing to a file.
Output bool `arg:"-o,--output" help:"Print output to stdout"`
}
type StarterParams ¶ added in v0.19.3
type StarterParams struct {
// File - Path to YAML schema file.
File string `arg:"positional,required" help:"Path to schema.yml / mach.yml"`
Name string `arg:"-n,--name" default:"MyMach" help:"Name of the state machine and the project directory"`
Uri string `arg:"-u,--uri" default:"asyncmachine.dev/mymach" help:"URI of this module for imports"`
Module bool `arg:"-m,--module" default:"true" help:"Generate go.mod"`
Handlers bool `arg:"-h,--handlers" default:"true" help:"Generate state-state handlers"`
Args bool `arg:"-a,--args" default:"true" help:"Generate common args and for each state tagged #args"`
Path string `arg:"-p,--path" help:"Base path for the generated project directory"`
Force bool `arg:"-f,--force" help:"Override output files (if any)"`
Inherit []string `` /* 149-byte string literal not displayed */
// internal
FileContent []byte `arg:"-"`
}