Merge branch 'feature/adrian-extendABCIcli' into develop

This commit is contained in:
Ethan Buchman
2017-05-15 12:30:02 -04:00

View File

@ -126,6 +126,22 @@ func main() {
Action: func(c *cli.Context) error { Action: func(c *cli.Context) error {
return cmdQuery(c) return cmdQuery(c)
}, },
Flags: []cli.Flag{
cli.StringFlag{
Name: "path",
Value: "/store",
Usage: "Path to prefix the query with",
},
cli.IntFlag{
Name: "height",
Value: 0,
Usage: "Height to query the blockchain at",
},
cli.BoolFlag{
Name: "prove",
Usage: "Whether or not to return a merkle proof of the query result",
},
},
}, },
} }
app.Before = before app.Before = before
@ -307,21 +323,27 @@ func cmdCommit(c *cli.Context) error {
} }
// Query application state // Query application state
// TODO: Make request and response support all fields.
func cmdQuery(c *cli.Context) error { func cmdQuery(c *cli.Context) error {
args := c.Args() args := c.Args()
if len(args) != 1 { if len(args) != 1 {
return errors.New("Command query takes 1 argument") return errors.New("Command query takes 1 argument, the query bytes")
} }
queryBytes, err := stringOrHexToBytes(c.Args()[0])
queryBytes, err := stringOrHexToBytes(args[0])
if err != nil { if err != nil {
return err return err
} }
path := c.String("path")
height := c.Int("height")
prove := c.Bool("prove")
resQuery, err := client.QuerySync(types.RequestQuery{ resQuery, err := client.QuerySync(types.RequestQuery{
Data: queryBytes, Data: queryBytes,
Path: "/store", // TOOD expose Path: path,
Height: 0, // TODO expose Height: uint64(height),
//Prove: true, // TODO expose Prove: prove,
}) })
if err != nil { if err != nil {
return err return err