package cliimport ()// ///// ///// /////// ///// ARGS// ///// ///// /////// Args is the top-level args struct for am-gen.////nolint:llltypeArgsstruct { StatesFile *StatesParams`arg:"subcommand:states-file" help:"Generate state schema files"` Grafana *GrafanaParams`arg:"subcommand:grafana" help:"Generate Grafana dashboards"` Version bool`arg:"-v,--version" help:"Print version and exit"`}// TODO dedicated descriptionsfunc (Args) () string {//nolint:lllreturnstrings.TrimLeft(dedent.Dedent(` am-gen generates state files and Grafana dashboards for asyncmachine-go state machines. Example: $ am-gen states-file --states State1,State2:multi \ --inherit basic,connected \ --groups Group1,Group2 \ --name MyMach Example: $ am-gen grafana --IDs MyMach1,MyMach2 \ --sync grafana-host.com `), "\n")}// ///// ///// /////// ///// GRAFANA// ///// ///// /////// GrafanaParams are params for the grafana subcommand.////nolint:llltypeGrafanaParamsstruct { 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:"-"`// TODO interval // Interval string}// ///// ///// /////// ///// SCHEMA FILE// ///// ///// /////// TODO validate param// var inherits = []string{"basic", "connected", "rpc/worker", "node/worker"}// StatesParams are params for the states-file subcommand.////nolint:llltypeStatesParamsstruct {// Version - print version Version bool// States - State names to generate. Eg: State1,State2 States string`arg:"-s,--states,required" help:"State names to generate. Eg: State1,State2"`// Inherit - Inherit from built-in states machines (comma separated): // - basic,connected // - rpc/statesrc // - node/worker Inherit string`arg:"-i,--inherit" help:"Inherit from built-in state-machines: basic,connected,rpc/statesrc,node/worker"`// 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,required" 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."`}
The pages are generated with Goldsv0.8.2. (GOOS=linux GOARCH=amd64)
Golds is a Go 101 project developed by Tapir Liu.
PR and bug reports are welcome and can be submitted to the issue list.
Please follow @zigo_101 (reachable from the left QR code) to get the latest news of Golds.