Hide all holding amounts when hidden flag toggled

pull/164/head
Miguel Mota 3 years ago
parent 1d29363185
commit 83a35df5c4
No known key found for this signature in database
GPG Key ID: 67EC1161588A00F9

@ -42,10 +42,6 @@ func (ct *Cointop) UpdateMarketbar() error {
totalstr = humanize.Monetaryf(total, 2)
}
if ct.State.hidePortfolioBalances {
totalstr = HiddenBalanceChars
}
timeframe := ct.State.selectedChartRange
chartname := ct.SelectedCoinName()
var charttitle string
@ -85,10 +81,15 @@ func (ct *Cointop) UpdateMarketbar() error {
)
}
totalstr = fmt.Sprintf("%s%s", ct.CurrencySymbol(), totalstr)
if ct.State.hidePortfolioBalances {
totalstr = HiddenBalanceChars
}
content = fmt.Sprintf(
"%sTotal Portfolio Value: %s • 24H: %s",
chartInfo,
ct.colorscheme.MarketBarLabelActive(fmt.Sprintf("%s%s", ct.CurrencySymbol(), totalstr)),
ct.colorscheme.MarketBarLabelActive(totalstr),
color24h(fmt.Sprintf("%.2f%%%s", percentChange24H, arrow)),
)
} else {

@ -145,6 +145,9 @@ func (ct *Cointop) GetPortfolioTable() *table.Table {
})
case "holdings":
text := strconv.FormatFloat(coin.Holdings, 'f', -1, 64)
if ct.State.hidePortfolioBalances {
text = HiddenBalanceChars
}
ct.SetTableColumnWidthFromString(header, text)
ct.SetTableColumnAlignLeft(header, false)
rowCells = append(rowCells,
@ -272,6 +275,9 @@ func (ct *Cointop) GetPortfolioTable() *table.Table {
percentHoldings = 0
}
text := fmt.Sprintf("%.2f%%", percentHoldings)
if ct.State.hidePortfolioBalances {
text = HiddenBalanceChars
}
ct.SetTableColumnWidthFromString(header, text)
ct.SetTableColumnAlignLeft(header, false)
rowCells = append(rowCells,
@ -773,6 +779,9 @@ func (ct *Cointop) PrintHoldingsTable(options *TablePrintOptions) error {
} else {
item[i] = strconv.FormatFloat(entry.Holdings, 'f', -1, 64)
}
if hideBalances {
item[i] = HiddenBalanceChars
}
case "balance":
if humanReadable {
item[i] = fmt.Sprintf("%s%s", symbol, humanize.Monetaryf(entry.Balance, 2))
@ -794,6 +803,9 @@ func (ct *Cointop) PrintHoldingsTable(options *TablePrintOptions) error {
} else {
item[i] = fmt.Sprintf("%.2f", percentHoldings)
}
if hideBalances {
item[i] = HiddenBalanceChars
}
}
}
records[i] = item

@ -185,7 +185,7 @@ draft: false
## How do I hide my portfolio balances (private mode)?
You can run cointop with the `--hide-portfolio-balances` flag to toggle hide/show portfolio balances or use the keyboard shortcut <kbd>Ctrl</kbd>+<kbd>space</kbd> on the portfolio page.
You can run cointop with the `--hide-portfolio-balances` flag to hide portfolio balances or use the keyboard shortcut <kbd>Ctrl</kbd>+<kbd>space</kbd> on the portfolio page to toggle hide/show.
## I'm getting question marks or weird symbols instead of the correct characters.

Loading…
Cancel
Save