2018-03-30 16:15:06 +00:00
|
|
|
package vm
|
|
|
|
|
|
|
|
import (
|
2021-02-10 08:53:01 +00:00
|
|
|
"os"
|
|
|
|
|
|
|
|
"github.com/abiosoft/readline"
|
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 {
|
2021-02-10 08:53:01 +00:00
|
|
|
p := vmcli.NewWithConfig(true, os.Exit, &readline.Config{
|
|
|
|
Stdout: ctx.App.Writer,
|
|
|
|
Stderr: ctx.App.ErrWriter,
|
|
|
|
})
|
2018-03-30 16:15:06 +00:00
|
|
|
return p.Run()
|
|
|
|
}
|