2019-07-09 22:58:51 +00:00
|
|
|
package cli
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
|
|
|
|
"gopkg.in/urfave/cli.v2"
|
|
|
|
)
|
|
|
|
|
|
|
|
var mpoolCmd = &cli.Command{
|
|
|
|
Name: "mpool",
|
|
|
|
Usage: "Manage message pool",
|
|
|
|
Subcommands: []*cli.Command{
|
|
|
|
mpoolPending,
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
var mpoolPending = &cli.Command{
|
|
|
|
Name: "pending",
|
|
|
|
Usage: "Get pending messages",
|
|
|
|
Action: func(cctx *cli.Context) error {
|
2019-07-12 04:09:04 +00:00
|
|
|
api, err := getAPI(cctx)
|
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
2019-07-09 22:58:51 +00:00
|
|
|
ctx := reqContext(cctx)
|
|
|
|
|
2019-07-11 02:36:43 +00:00
|
|
|
msgs, err := api.MpoolPending(ctx, nil)
|
2019-07-09 22:58:51 +00:00
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
|
|
|
for _, msg := range msgs {
|
|
|
|
fmt.Println(msg)
|
|
|
|
}
|
|
|
|
|
|
|
|
return nil
|
|
|
|
},
|
|
|
|
}
|