fix tvx init.

This commit is contained in:
Raúl Kripalani 2020-10-23 13:30:04 +01:00
parent 5301c416bc
commit 39d9150175
4 changed files with 14 additions and 10 deletions

View File

@ -49,6 +49,8 @@ var extractCmd = &cli.Command{
Name: "extract",
Description: "generate a test vector by extracting it from a live chain",
Action: runExtract,
Before: initialize,
After: destroy,
Flags: []cli.Flag{
&repoFlag,
&cli.StringFlag{

View File

@ -43,6 +43,8 @@ var extractManyCmd = &cli.Command{
after these compulsory seven.
`,
Action: runExtractMany,
Before: initialize,
After: destroy,
Flags: []cli.Flag{
&repoFlag,
&cli.StringFlag{

View File

@ -1,6 +1,7 @@
package main
import (
"fmt"
"log"
"os"
"sort"
@ -47,11 +48,6 @@ func main() {
tvx extract-many performs a batch extraction of many messages, supplied in a
CSV file. Refer to the help of that subcommand for more info.
tvx project projects an existing test vector against a different protocol
version, reporting the result, optionally appending a new variant to the
vector in place if deemed equivalent, or producing a new vector if
non-equivalent.
tvx simulate takes a raw message and simulates it on top of the supplied
epoch, reporting the result on stderr and writing a test vector on stdout
or into the specified file.
@ -80,8 +76,6 @@ func main() {
extractManyCmd,
simulateCmd,
},
Before: initialize,
After: destroy,
}
sort.Sort(cli.CommandsByName(app.Commands))
@ -107,7 +101,9 @@ func initialize(c *cli.Context) error {
// Make the API client.
var err error
FullAPI, Closer, err = lcli.GetFullNodeAPI(c)
if FullAPI, Closer, err = lcli.GetFullNodeAPI(c); err != nil {
err = fmt.Errorf("failed to locate Lotus node; ")
}
return err
}

View File

@ -29,15 +29,19 @@ var simulateFlags struct {
var simulateCmd = &cli.Command{
Name: "simulate",
Description: "simulate a raw message on top of the supplied" +
"epoch, reporting the result on stderr and writing a test vector on stdout" +
Description: "simulate a raw message on top of the supplied epoch (or HEAD), " +
"reporting the result on stderr and writing a test vector on stdout " +
"or into the specified file",
Action: runSimulateCmd,
Before: initialize,
After: destroy,
Flags: []cli.Flag{
&repoFlag,
&cli.StringFlag{
Name: "msg",
Usage: "base64 cbor-encoded message",
Destination: &simulateFlags.msg,
Required: true,
},
&cli.Int64Flag{
Name: "at-epoch",