rename command to cancel-retrieval; rename args to follow Lotus style.

This commit is contained in:
Raúl Kripalani 2021-03-26 16:37:46 +00:00
parent 47f7208f38
commit fd91c095c4
2 changed files with 11 additions and 10 deletions

View File

@ -89,7 +89,7 @@ var clientCmd = &cli.Command{
WithCategory("data", clientStat), WithCategory("data", clientStat),
WithCategory("retrieval", clientFindCmd), WithCategory("retrieval", clientFindCmd),
WithCategory("retrieval", clientRetrieveCmd), WithCategory("retrieval", clientRetrieveCmd),
WithCategory("retrieval", clientCancelRetrievalDeal), WithCategory("retrieval", clientCancelRetrievalDealCmd),
WithCategory("util", clientCommPCmd), WithCategory("util", clientCommPCmd),
WithCategory("util", clientCarGenCmd), WithCategory("util", clientCarGenCmd),
WithCategory("util", clientBalancesCmd), WithCategory("util", clientBalancesCmd),
@ -1976,13 +1976,13 @@ var clientCancelTransfer = &cli.Command{
}, },
} }
var clientCancelRetrievalDeal = &cli.Command{ var clientCancelRetrievalDealCmd = &cli.Command{
Name: "retrieve-cancel", Name: "cancel-retrieval",
Usage: "Cancel a retrieval deal by DealID", Usage: "Cancel a retrieval deal by deal ID; this also cancels the associated transfer",
Flags: []cli.Flag{ Flags: []cli.Flag{
&cli.Int64Flag{ &cli.Int64Flag{
Name: "dealid", Name: "deal-id",
Usage: "specify retrieval deal by DealID", Usage: "specify retrieval deal by deal ID",
Required: true, Required: true,
}, },
}, },
@ -1994,11 +1994,12 @@ var clientCancelRetrievalDeal = &cli.Command{
defer closer() defer closer()
ctx := ReqContext(cctx) ctx := ReqContext(cctx)
if cctx.Int64("dealid") < 0 { id := cctx.Int64("deal-id")
if id < 0 {
return errors.New("deal id cannot be negative") return errors.New("deal id cannot be negative")
} }
return api.ClientCancelRetrievalDeal(ctx, retrievalmarket.DealID(cctx.Int64("dealid"))) return api.ClientCancelRetrievalDeal(ctx, retrievalmarket.DealID(id))
}, },
} }

View File

@ -475,10 +475,10 @@ func (a *API) ClientListImports(ctx context.Context) ([]api.Import, error) {
return out, nil return out, nil
} }
func (a *API) ClientCancelRetrievalDeal(ctx context.Context, dealid retrievalmarket.DealID) error { func (a *API) ClientCancelRetrievalDeal(ctx context.Context, dealID retrievalmarket.DealID) error {
cerr := make(chan error) cerr := make(chan error)
go func() { go func() {
err := a.Retrieval.CancelDeal(dealid) err := a.Retrieval.CancelDeal(dealID)
select { select {
case cerr <- err: case cerr <- err: