2018-03-30 16:15:06 +00:00
|
|
|
package vm
|
|
|
|
|
|
|
|
import (
|
2021-02-10 08:53:01 +00:00
|
|
|
"os"
|
|
|
|
|
2022-02-15 12:55:25 +00:00
|
|
|
"github.com/chzyer/readline"
|
2022-08-05 10:32:37 +00:00
|
|
|
"github.com/nspcc-dev/neo-go/cli/cmdargs"
|
2020-03-03 14:21:42 +00:00
|
|
|
vmcli "github.com/nspcc-dev/neo-go/pkg/vm/cli"
|
2018-03-30 16:15:06 +00:00
|
|
|
"github.com/urfave/cli"
|
|
|
|
)
|
|
|
|
|
2019-10-19 20:58:45 +00:00
|
|
|
// NewCommands returns 'vm' command.
|
|
|
|
func NewCommands() []cli.Command {
|
|
|
|
return []cli.Command{{
|
2018-03-30 16:15:06 +00:00
|
|
|
Name: "vm",
|
|
|
|
Usage: "start the virtual machine",
|
|
|
|
Action: startVMPrompt,
|
|
|
|
Flags: []cli.Flag{
|
|
|
|
cli.BoolFlag{Name: "debug, d"},
|
|
|
|
},
|
2019-10-19 20:58:45 +00:00
|
|
|
}}
|
2018-03-30 16:15:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func startVMPrompt(ctx *cli.Context) error {
|
2022-08-05 10:32:37 +00:00
|
|
|
if err := cmdargs.EnsureNone(ctx); err != nil {
|
|
|
|
return err
|
|
|
|
}
|
2022-02-15 12:55:25 +00:00
|
|
|
p := vmcli.NewWithConfig(true, os.Exit, &readline.Config{})
|
2018-03-30 16:15:06 +00:00
|
|
|
return p.Run()
|
|
|
|
}
|