Commit 42305d82 authored by Inphi's avatar Inphi Committed by GitHub

cannon: Fix custom --help for multicannon subcommands (#12112)

* multicannon: Display custom --help for missing flags

* remove comment
parent 12a38d0d
......@@ -4,17 +4,17 @@ import (
"fmt"
"os"
"github.com/ethereum-optimism/optimism/cannon/cmd"
"github.com/ethereum-optimism/optimism/cannon/mipsevm/versions"
"github.com/urfave/cli/v2"
)
func LoadELF(ctx *cli.Context) error {
if len(os.Args) == 2 && os.Args[2] == "--help" {
if len(os.Args) == 3 && os.Args[2] == "--help" {
if err := list(); err != nil {
return err
}
fmt.Println("use `--type <vm type> --help` to get more detailed help")
return nil
}
typ, err := parseFlag(os.Args[1:], "--type")
......@@ -28,4 +28,10 @@ func LoadELF(ctx *cli.Context) error {
return ExecuteCannon(ctx.Context, os.Args[1:], ver)
}
var LoadELFCommand = cmd.CreateLoadELFCommand(LoadELF)
var LoadELFCommand = &cli.Command{
Name: "load-elf",
Usage: "Load ELF file into Cannon state",
Description: "Load ELF file into Cannon state",
Action: LoadELF,
SkipFlagParsing: true,
}
......@@ -16,6 +16,7 @@ func Run(ctx *cli.Context) error {
return err
}
fmt.Println("use `--input <valid input file> --help` to get more detailed help")
return nil
}
inputPath, err := parsePathFlag(os.Args[1:], "--input")
......@@ -29,7 +30,6 @@ func Run(ctx *cli.Context) error {
return ExecuteCannon(ctx.Context, os.Args[1:], version)
}
// var RunCommand = cmd.CreateRunCommand(Run)
var RunCommand = &cli.Command{
Name: "run",
Usage: "Run VM step(s) and generate proof data to replicate onchain.",
......
......@@ -6,7 +6,6 @@ import (
"github.com/urfave/cli/v2"
"github.com/ethereum-optimism/optimism/cannon/cmd"
"github.com/ethereum-optimism/optimism/cannon/mipsevm/versions"
)
......@@ -16,6 +15,7 @@ func Witness(ctx *cli.Context) error {
return err
}
fmt.Println("use `--input <valid input file> --help` to get more detailed help")
return nil
}
inputPath, err := parsePathFlag(os.Args[1:], "--input")
......@@ -29,4 +29,10 @@ func Witness(ctx *cli.Context) error {
return ExecuteCannon(ctx.Context, os.Args[1:], version)
}
var WitnessCommand = cmd.CreateWitnessCommand(Witness)
var WitnessCommand = &cli.Command{
Name: "witness",
Usage: "Convert a Cannon JSON state into a binary witness",
Description: "Convert a Cannon JSON state into a binary witness. The hash of the witness is written to stdout",
Action: Witness,
SkipFlagParsing: true,
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment