2018-01-26 18:04:13 +00:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
2018-02-09 16:08:50 +00:00
|
|
|
"os"
|
2018-01-26 18:04:13 +00:00
|
|
|
|
2020-03-03 14:21:42 +00:00
|
|
|
"github.com/nspcc-dev/neo-go/cli/server"
|
|
|
|
"github.com/nspcc-dev/neo-go/cli/smartcontract"
|
2020-08-04 06:40:06 +00:00
|
|
|
"github.com/nspcc-dev/neo-go/cli/util"
|
2020-03-03 14:21:42 +00:00
|
|
|
"github.com/nspcc-dev/neo-go/cli/vm"
|
|
|
|
"github.com/nspcc-dev/neo-go/cli/wallet"
|
2020-03-25 15:30:21 +00:00
|
|
|
"github.com/nspcc-dev/neo-go/pkg/config"
|
2018-02-09 16:08:50 +00:00
|
|
|
"github.com/urfave/cli"
|
2018-01-26 18:04:13 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
func main() {
|
2020-08-29 11:41:33 +00:00
|
|
|
ctl := newApp()
|
|
|
|
|
|
|
|
if err := ctl.Run(os.Args); err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func newApp() *cli.App {
|
2018-02-09 16:08:50 +00:00
|
|
|
ctl := cli.NewApp()
|
|
|
|
ctl.Name = "neo-go"
|
2019-08-26 14:05:17 +00:00
|
|
|
ctl.Version = config.Version
|
2018-02-24 09:10:45 +00:00
|
|
|
ctl.Usage = "Official Go client for Neo"
|
cli: set ctl.ErrWriter
We did not have it set, however we use it in the several places which
results with the following panic:
```
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x18 pc=0x4ddf0d]
goroutine 1 [running]:
fmt.Fprintln(0x0, 0x0, 0xc0001d7c08, 0x1, 0x1, 0x10376c0, 0xc0002051c0, 0x0)
fmt/print.go:265 +0x5d
github.com/nspcc-dev/neo-go/cli/wallet.transferNEP5(0xc0000a9080, 0x0, 0x0)
github.com/nspcc-dev/neo-go/cli/wallet/nep5.go:445 +0x9eb
github.com/urfave/cli.HandleAction(0xc837c0, 0xf26198, 0xc0000a9080, 0xc00007f600, 0x0)
github.com/urfave/cli@v1.20.0/app.go:490 +0xc8
github.com/urfave/cli.Command.Run(0xdc66a3, 0x8, 0x0, 0x0, 0x0, 0x0, 0x0, 0xdd0b0d, 0x14, 0xdf6c25, ...)
github.com/urfave/cli@v1.20.0/command.go:210 +0x9e8
github.com/urfave/cli.(*App).RunAsSubcommand(0xc0001aa340, 0xc0000a8dc0, 0x0, 0x0)
github.com/urfave/cli@v1.20.0/app.go:379 +0x88b
github.com/urfave/cli.Command.startApp(0xdc23e4, 0x4, 0x0, 0x0, 0x0, 0x0, 0x0, 0xdd546a, 0x18, 0x0, ...)
github.com/urfave/cli@v1.20.0/command.go:298 +0x81a
github.com/urfave/cli.Command.Run(0xdc23e4, 0x4, 0x0, 0x0, 0x0, 0x0, 0x0, 0xdd546a, 0x18, 0x0, ...)
github.com/urfave/cli@v1.20.0/command.go:98 +0x1219
github.com/urfave/cli.(*App).RunAsSubcommand(0xc0001aa1a0, 0xc0000a8c60, 0x0, 0x0)
github.com/urfave/cli@v1.20.0/app.go:379 +0x88b
github.com/urfave/cli.Command.startApp(0xdc45bf, 0x6, 0x0, 0x0, 0x0, 0x0, 0x0, 0xde1d28, 0x24, 0x0, ...)
github.com/urfave/cli@v1.20.0/command.go:298 +0x81a
github.com/urfave/cli.Command.Run(0xdc45bf, 0x6, 0x0, 0x0, 0x0, 0x0, 0x0, 0xde1d28, 0x24, 0x0, ...)
github.com/urfave/cli@v1.20.0/command.go:98 +0x1219
github.com/urfave/cli.(*App).Run(0xc0001aa000, 0xc000030120, 0x12, 0x12, 0x0, 0x0)
github.com/urfave/cli@v1.20.0/app.go:255 +0x741
main.main()
command-line-arguments/main.go:18 +0x4b
```
2020-11-10 12:17:06 +00:00
|
|
|
ctl.ErrWriter = os.Stdout
|
2018-01-26 18:04:13 +00:00
|
|
|
|
2019-10-19 20:58:45 +00:00
|
|
|
ctl.Commands = append(ctl.Commands, server.NewCommands()...)
|
|
|
|
ctl.Commands = append(ctl.Commands, smartcontract.NewCommands()...)
|
|
|
|
ctl.Commands = append(ctl.Commands, wallet.NewCommands()...)
|
|
|
|
ctl.Commands = append(ctl.Commands, vm.NewCommands()...)
|
2020-08-04 06:40:06 +00:00
|
|
|
ctl.Commands = append(ctl.Commands, util.NewCommands()...)
|
2020-08-29 11:41:33 +00:00
|
|
|
return ctl
|
2018-01-26 18:04:13 +00:00
|
|
|
}
|