fix(lotus-sim): rename step to run

And make it run forever by default.
This commit is contained in:
Steven Allen 2021-06-07 14:55:39 -07:00
parent 8000decac6
commit be9e30e39d
2 changed files with 6 additions and 6 deletions

View File

@ -15,7 +15,7 @@ var root []*cli.Command = []*cli.Command{
createSimCommand, createSimCommand,
deleteSimCommand, deleteSimCommand,
listSimCommand, listSimCommand,
stepSimCommand, runSimCommand,
upgradeCommand, upgradeCommand,
} }

View File

@ -6,13 +6,13 @@ import (
"github.com/urfave/cli/v2" "github.com/urfave/cli/v2"
) )
var stepSimCommand = &cli.Command{ var runSimCommand = &cli.Command{
Name: "step", Name: "run",
Description: "Run the simulation.",
Flags: []cli.Flag{ Flags: []cli.Flag{
&cli.IntFlag{ &cli.IntFlag{
Name: "epochs", Name: "epochs",
Usage: "Advance at least the given number of epochs.", Usage: "Advance the given number of epochs then stop.",
Value: 1,
}, },
}, },
Action: func(cctx *cli.Context) error { Action: func(cctx *cli.Context) error {
@ -33,7 +33,7 @@ var stepSimCommand = &cli.Command{
} }
fmt.Fprintln(cctx.App.Writer, "running simulation") fmt.Fprintln(cctx.App.Writer, "running simulation")
targetEpochs := cctx.Int("epochs") targetEpochs := cctx.Int("epochs")
for i := 0; i < targetEpochs; i++ { for i := 0; targetEpochs == 0 || i < targetEpochs; i++ {
ts, err := sim.Step(cctx.Context) ts, err := sim.Step(cctx.Context)
if err != nil { if err != nil {
return err return err