Skip to content

Commit

Permalink
Merge pull request #5549 from filecoin-project/feat/cli-pending-publish
Browse files Browse the repository at this point in the history
Output more info in pending-publish CLI
  • Loading branch information
magik6k authored Feb 9, 2021
2 parents 55007a0 + eb03422 commit 811fb44
Showing 1 changed file with 17 additions and 9 deletions.
26 changes: 17 additions & 9 deletions cmd/lotus-storage-miner/market.go
Original file line number Diff line number Diff line change
Expand Up @@ -858,18 +858,26 @@ var dealsPendingPublish = &cli.Command{
return xerrors.Errorf("getting pending deals: %w", err)
}

w := tabwriter.NewWriter(os.Stdout, 2, 4, 2, ' ', 0)
_, _ = fmt.Fprintf(w, "ProposalCID\tClient\tSize\n")
if len(pending.Deals) > 0 {
endsIn := pending.PublishPeriodStart.Add(pending.PublishPeriod).Sub(time.Now())
w := tabwriter.NewWriter(os.Stdout, 2, 4, 2, ' ', 0)
_, _ = fmt.Fprintf(w, "Publish period: %s (ends in %s)\n", pending.PublishPeriod, endsIn.Round(time.Second))
_, _ = fmt.Fprintf(w, "First deal queued at: %s\n", pending.PublishPeriodStart)
_, _ = fmt.Fprintf(w, "Deals will be published at: %s\n", pending.PublishPeriodStart.Add(pending.PublishPeriod))
_, _ = fmt.Fprintf(w, "%d deals queued to be published:\n", len(pending.Deals))
_, _ = fmt.Fprintf(w, "ProposalCID\tClient\tSize\n")
for _, deal := range pending.Deals {
proposalNd, err := cborutil.AsIpld(&deal) // nolint
if err != nil {
return err
}

for _, deal := range pending.Deals {
proposalNd, err := cborutil.AsIpld(&deal) // nolint
if err != nil {
return err
_, _ = fmt.Fprintf(w, "%s\t%s\t%s\n", proposalNd.Cid(), deal.Proposal.Client, units.BytesSize(float64(deal.Proposal.PieceSize)))
}

_, _ = fmt.Fprintf(w, "%s\t%s\t%s\n", proposalNd.Cid(), deal.Proposal.Client, units.BytesSize(float64(deal.Proposal.PieceSize)))
return w.Flush()
}

return w.Flush()
fmt.Println("No deals queued to be published")
return nil
},
}

0 comments on commit 811fb44

Please sign in to comment.