neoneo-go/cli/vm/vm.go
Roman Khimov 1518019be8 cli: add excessive arguments checks
Some commands don't accept arguments, but users try giving them and don't
notice a mistake. It's a bit more user-friendly to tell the user that there is
something wrong with the way he tries to use the command.
2022-08-05 15:50:12 +03:00

30 lines
610 B
Go

package vm
import (
"os"
"github.com/chzyer/readline"
"github.com/nspcc-dev/neo-go/cli/cmdargs"
vmcli "github.com/nspcc-dev/neo-go/pkg/vm/cli"
"github.com/urfave/cli"
)
// NewCommands returns 'vm' command.
func NewCommands() []cli.Command {
return []cli.Command{{
Name: "vm",
Usage: "start the virtual machine",
Action: startVMPrompt,
Flags: []cli.Flag{
cli.BoolFlag{Name: "debug, d"},
},
}}
}
func startVMPrompt(ctx *cli.Context) error {
if err := cmdargs.EnsureNone(ctx); err != nil {
return err
}
p := vmcli.NewWithConfig(true, os.Exit, &readline.Config{})
return p.Run()
}