Skip to content

Commit cda23a8

Browse files
committed
Fix color in Window
1 parent 764bd96 commit cda23a8

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,10 @@ Track token prices in your favorite exchanges from the terminal. Best CLI tool f
3434

3535
If you have [Go](https://golang.org/) (1.9+) installed:
3636
```bash
37-
$ go get github.com/polyrabbit/token-ticker
37+
$ go get -u github.com/polyrabbit/token-ticker
3838
```
3939

40-
Or download executable from the [release page](https://github.com/polyrabbit/token-ticker/releases/latest)
40+
Or download executable from the [release page](https://github.com/polyrabbit/token-ticker/releases/latest), and put it into your `PATH`.
4141

4242
### Usage
4343

@@ -61,7 +61,7 @@ Options:
6161
-t, --timeout int HTTP request timeout in seconds (default 20)
6262
6363
Exchange.Token Pairs:
64-
Specify which exchange and token pair to query, different exchanges use different forms to express tokens, refer to their URLs to find the format, eg. to get BitCoin price from Bitfinex and CoinMarketCap you should use query string "Bitfinex.BTCUSDT CoinMarketCap.Bitcoin"
64+
Specify which exchange and token pair to query, different exchanges use different forms to express tokens/trading pairs, refer to their URLs to find the format, eg. to get BitCoin price from Bitfinex and CoinMarketCap you should use query string "Bitfinex.BTCUSDT CoinMarketCap.Bitcoin"
6565
6666
Find help/updates from here - https://github.com/polyrabbit/token-ticker
6767
```

main.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import (
1212
"encoding/json"
1313
"github.com/fatih/color"
1414
"github.com/gosuri/uilive"
15+
"github.com/mattn/go-colorable"
1516
"github.com/olekukonko/tablewriter"
1617
. "github.com/polyrabbit/token-ticker/exchange"
1718
"github.com/sirupsen/logrus"
@@ -157,7 +158,7 @@ func showUsageAndExit() {
157158
fmt.Fprintln(os.Stderr, "\nOptions:")
158159
pflag.PrintDefaults()
159160
fmt.Fprintln(os.Stderr, "\nExchange.Token Pairs:")
160-
fmt.Fprintln(os.Stderr, " Specify which exchange and token pair to query, different exchanges use different forms to express tokens, refer to their URLs to find the format"+
161+
fmt.Fprintln(os.Stderr, " Specify which exchange and token pair to query, different exchanges use different forms to express tokens/trading pairs, refer to their URLs to find the format"+
161162
" (eg. to get BitCoin price from Bitfinex and CoinMarketCap you should use query string \"Bitfinex.BTCUSDT CoinMarketCap.Bitcoin\").")
162163
fmt.Fprintln(os.Stderr, "\nFind help/updates from here - https://github.com/polyrabbit/token-ticker")
163164
os.Exit(0)
@@ -170,6 +171,7 @@ func init() {
170171
TimestampFormat: "15:04:05",
171172
}
172173
logrus.SetFormatter(formatter)
174+
logrus.SetOutput(colorable.NewColorableStderr()) // For Windows
173175

174176
showVersion := pflag.BoolP("version", "v", false, "Show version number")
175177
showHelp := pflag.BoolP("help", "h", false, "Show usage message")
@@ -308,8 +310,9 @@ func main() {
308310
go checkForUpdate(httpClient)
309311

310312
var writer = uilive.New()
313+
writer.Out = colorable.NewColorableStdout() // For Windows
311314
logrus.SetOutput(writer)
312-
defer logrus.SetOutput(os.Stderr)
315+
defer logrus.SetOutput(colorable.NewColorableStderr())
313316

314317
for {
315318
symbolPriceList := getSymbolPrice(configs, httpClient)

0 commit comments

Comments
 (0)