Commit f0e13532 authored by Luke Champine's avatar Luke Champine Committed by GitHub

Merge pull request #1563 from lolsteve/hostdb-print

HostDB tabbed print
parents 2f4ee9d4 46f0b165
......@@ -2,6 +2,8 @@ package main
import (
"fmt"
"os"
"text/tabwriter"
"github.com/spf13/cobra"
......@@ -28,9 +30,12 @@ func hostdbcmd() {
fmt.Println("No known active hosts")
return
}
fmt.Println("Active hosts:")
fmt.Println(len(info.Hosts), "active hosts:")
w := tabwriter.NewWriter(os.Stdout, 0, 0, 2, ' ', 0)
fmt.Fprintln(w, "Address\tPrice")
for _, host := range info.Hosts {
price := host.StoragePrice.Mul(modules.BlockBytesPerMonthTerabyte)
fmt.Printf("\t%v - %v / TB / Month\n", host.NetAddress, currencyUnits(price))
fmt.Fprintf(w, "%v\t%v / TB / Month\n", host.NetAddress, currencyUnits(price))
}
w.Flush()
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment