Skip to content

Commit

Permalink
render summaries
Browse files Browse the repository at this point in the history
  • Loading branch information
Pantani committed Feb 17, 2022
1 parent 268b538 commit 2a2a031
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 4 deletions.
1 change: 1 addition & 0 deletions starport/cmd/network.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ func NewNetwork() *cobra.Command {
// add sub commands.
c.AddCommand(
NewNetworkChain(),
NewNetworkCampaign(),
NewNetworkRequest(),
)

Expand Down
24 changes: 20 additions & 4 deletions starport/cmd/network_campaign_list.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,20 +63,36 @@ func renderCampaignSummaries(campaigns []networktypes.Campaign, out io.Writer) e
var campaignEntries [][]string

for _, c := range campaigns {
totalSupply := "-"
if c.TotalSupply != "" {
totalSupply = c.TotalSupply
}
allocatedShares := "-"
if c.AllocatedShares != "" {
allocatedShares = c.AllocatedShares
}
dynamicShares := "no"
if c.DynamicShares {
dynamicShares = "yes"
}
totalShares := "-"
if c.TotalShares != "" {
totalShares = c.TotalShares
}
mainnetID := "-"
if c.MainnetInitialized {
mainnetID = fmt.Sprintf("%d", c.MainnetID)
}

campaignEntries = append(campaignEntries, []string{
fmt.Sprintf("%d", c.ID),
c.Name,
fmt.Sprintf("%d", c.CoordinatorID),
fmt.Sprintf("%d", c.MainnetID),
c.TotalSupply,
c.AllocatedShares,
mainnetID,
totalSupply,
allocatedShares,
dynamicShares,
c.TotalShares,
totalShares,
})
}

Expand Down

0 comments on commit 2a2a031

Please sign in to comment.