OSDN Git Service

Hulk did something
[bytom/vapor.git] / cmd / bytomcli / commands / program.go
1 package commands
2
3 import (
4         "os"
5
6         "github.com/spf13/cobra"
7
8         "github.com/vapor/util"
9 )
10
11 var decodeProgCmd = &cobra.Command{
12         Use:   "decode-program <program>",
13         Short: "decode program to instruction and data",
14         Args:  cobra.ExactArgs(1),
15         Run: func(cmd *cobra.Command, args []string) {
16                 var req = struct {
17                         Program string `json:"program"`
18                 }{Program: args[0]}
19
20                 data, exitCode := util.ClientCall("/decode-program", &req)
21                 if exitCode != util.Success {
22                         os.Exit(exitCode)
23                 }
24                 printJSON(data)
25         },
26 }