coinpare 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +13 -1
- data/README.md +39 -11
- data/coinpare.gemspec +17 -14
- data/lib/coinpare/cli.rb +4 -1
- data/lib/coinpare/commands/coins.rb +8 -2
- data/lib/coinpare/commands/holdings.rb +86 -10
- data/lib/coinpare/commands/markets.rb +8 -2
- data/lib/coinpare/version.rb +3 -1
- metadata +37 -29
- data/.gitignore +0 -12
- data/.rspec +0 -3
- data/.travis.yml +0 -34
- data/CODE_OF_CONDUCT.md +0 -74
- data/Gemfile +0 -14
- data/lib/coinpare/commands/.gitkeep +0 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dc5acc59ac68bf078d8aed7c0cd936f16fda6db021bc8f14559fae43f7bc7efb
|
4
|
+
data.tar.gz: d6fda12725def1b6dbb210a15503f8d514ef08b96c52b53298cc6f0bb8ddd8ca
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c3a7e96d6577e227da747c29d64be46ccb6147c1a87e133ae03860de1d9c2700af9ce36f62197277a8fa0957decf8572c4fd83aea7e28d646f00354949bf6068
|
7
|
+
data.tar.gz: 76675509059502f630f91ae51755981fb11a47162743b874dd58faa3b219c86fc6f043556eb257de22d1287336080f2e77c0e5318f3cb530e6f09c6bd3f04ee2
|
data/CHANGELOG.md
CHANGED
@@ -1,7 +1,19 @@
|
|
1
1
|
# Change log
|
2
2
|
|
3
|
-
## [v0.
|
3
|
+
## [v0.2.0] - 2019-01-12
|
4
|
+
|
5
|
+
### Added
|
6
|
+
* Add ability to display total purchased and current holdings in pie chart format
|
7
|
+
* Add vim key navigation bindings for menu selection
|
8
|
+
|
9
|
+
### Changed
|
10
|
+
* Change gemspec to update runtime dependencies, load dependent files directly and require Ruby >= 2.0
|
11
|
+
* Change to provide error messages for required inputs when creating holdings
|
12
|
+
* Change coins & markets commands to use system pager and page only when content exceeds screen height
|
13
|
+
|
14
|
+
## [v0.1.0] - 2018-05-17
|
4
15
|
|
5
16
|
* Initial implementation and release
|
6
17
|
|
18
|
+
[v0.2.0]: https://github.com/piotrmurach/coinpare/compare/v0.1.0...v0.2.0
|
7
19
|
[v0.1.0]: https://github.com/piotrmurach/coinpare/compare/v0.1.0
|
data/README.md
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
<div align="center">
|
2
|
-
<img width="207" src="https://
|
2
|
+
<img width="207" src="https://github.com/piotrmurach/coinpare/raw/master/assets/coinpare_logo_stacked.png" alt="coinpare logo" />
|
3
3
|
</div>
|
4
4
|
<br/>
|
5
5
|
|
@@ -7,6 +7,7 @@
|
|
7
7
|
|
8
8
|
[![Gem Version](https://badge.fury.io/rb/coinpare.svg)][gem]
|
9
9
|
[![Build Status](https://secure.travis-ci.org/piotrmurach/coinpare.svg?branch=master)][travis]
|
10
|
+
[![Build status](https://ci.appveyor.com/api/projects/status/dsd3cone86it12pi?svg=true)][appveyor]
|
10
11
|
[![Maintainability](https://api.codeclimate.com/v1/badges/1072406ba7e951e355e4/maintainability)][codeclimate]
|
11
12
|
[![Test Coverage](https://api.codeclimate.com/v1/badges/1072406ba7e951e355e4/test_coverage)][coverage]
|
12
13
|
[![Inline docs](http://inch-ci.org/github/piotrmurach/coinpare.svg?branch=master)][inchpages]
|
@@ -14,6 +15,7 @@
|
|
14
15
|
[gitter]: https://gitter.im/piotrmurach/coinpare
|
15
16
|
[gem]: http://badge.fury.io/rb/coinpare
|
16
17
|
[travis]: http://travis-ci.org/piotrmurach/coinpare
|
18
|
+
[appveyor]: https://ci.appveyor.com/project/piotrmurach/coinpare
|
17
19
|
[codeclimate]: https://codeclimate.com/github/piotrmurach/coinpare/maintainability
|
18
20
|
[coverage]: https://codeclimate.com/github/piotrmurach/coinpare/test_coverage
|
19
21
|
[inchpages]: http://inch-ci.org/github/piotrmurach/coinpare
|
@@ -52,14 +54,25 @@ $ coinpare
|
|
52
54
|
|
53
55
|
## Features
|
54
56
|
|
55
|
-
* Compare
|
57
|
+
* Compare purchased or top coins trading info(price, vol, open, high, low etc)
|
56
58
|
* Compare top markets by a trading coin pair
|
57
|
-
* Create
|
59
|
+
* Create custom portfolio and track your holdings
|
60
|
+
* Display portfolio in a table or pie chart
|
58
61
|
* Auto refresh cryptocurrencies info with a configurable time interval
|
59
62
|
|
60
|
-
##
|
63
|
+
## Contents
|
61
64
|
|
62
|
-
|
65
|
+
* [1. Usage](#1-usage)
|
66
|
+
* [2. View coins](#2-view-coins)
|
67
|
+
* [3. View markets](#3-view-markets)
|
68
|
+
* [4. Create portfolio](#4-create-portfolio)
|
69
|
+
* [4.1 Edit coins](#41-edit-coins)
|
70
|
+
* [4.2 Add/remove coins](#42-addremove-coins)
|
71
|
+
* [4.3 Pie charts](#43-pie-charts)
|
72
|
+
|
73
|
+
## 1. Usage
|
74
|
+
|
75
|
+
To use all available commands, run the following in your terminal:
|
63
76
|
|
64
77
|
```bash
|
65
78
|
$ coinpare
|
@@ -69,7 +82,7 @@ You will be presented with the following interface:
|
|
69
82
|
|
70
83
|
![Interface](https://github.com/piotrmurach/coinpare/raw/master/assets/coinpare_interface.png)
|
71
84
|
|
72
|
-
## View coins
|
85
|
+
## 2. View coins
|
73
86
|
|
74
87
|
You can see top 10 trading info (price, volume, open, high, low etc) of any cyptocurrency in any other currency by executing the following in your terminal:
|
75
88
|
|
@@ -101,7 +114,7 @@ You can also change the default exchange `CCCAGG` using the `--exchange` or `-e`
|
|
101
114
|
$ coinpare coins BTC ETH --exchange coinbase
|
102
115
|
```
|
103
116
|
|
104
|
-
See [view markets](#view-markets) for more information on available exchanges.
|
117
|
+
See [view markets](#3-view-markets) for more information on available exchanges.
|
105
118
|
|
106
119
|
Finally, if you want to auto refresh data use `--watch` or `-w` flag:
|
107
120
|
|
@@ -124,7 +137,7 @@ $ coinpare coins --watch 20 # every 20 seconds
|
|
124
137
|
|
125
138
|
To finish watching for changes hold down `Ctrl+C` key combination.
|
126
139
|
|
127
|
-
## View markets
|
140
|
+
## 3. View markets
|
128
141
|
|
129
142
|
You can get top markets by volume for any currency pair. By default 10 top exchanges for the BTC and USD pair by their total volume across all markets in the last 24 hours are displayed.
|
130
143
|
|
@@ -163,7 +176,7 @@ $ coinpare markets -w
|
|
163
176
|
|
164
177
|
To finish watching for changes hold down `Ctrl+C` key combination.
|
165
178
|
|
166
|
-
## Create portfolio
|
179
|
+
## 4. Create portfolio
|
167
180
|
|
168
181
|
There is an easy way for you to keep track of all your investments using the `holdings` command.
|
169
182
|
When run for the first time, you will be presented with a prompt that will guide you through the portfolio setup and allow you to add as many holdings as you wish.
|
@@ -176,6 +189,8 @@ The prompt may look:
|
|
176
189
|
|
177
190
|
![CreateHoldings](https://github.com/piotrmurach/coinpare/raw/master/assets/coinpare_create_holdings.png)
|
178
191
|
|
192
|
+
### 4.1 Edit coins
|
193
|
+
|
179
194
|
All your holdings information will be persisted in your user home directory in a file called `coinpare.toml`. You can edit this file directly using your configured editor by passing the `--edit` flag:
|
180
195
|
|
181
196
|
```bash
|
@@ -211,7 +226,7 @@ color = true
|
|
211
226
|
exchange = "CCCAGG"
|
212
227
|
```
|
213
228
|
|
214
|
-
Once configured, any subsequent execution of `holdings` command will display current prices and totals. For example, the
|
229
|
+
Once configured, any subsequent execution of `holdings` command will display current prices and totals. For example, the before mentioned configuration file may produce the following result:
|
215
230
|
|
216
231
|
![ViewHoldings](https://github.com/piotrmurach/coinpare/raw/master/assets/coinpare_holdings.png)
|
217
232
|
|
@@ -224,7 +239,7 @@ $ coinpare holdings -w
|
|
224
239
|
|
225
240
|
To finish watching for changes hold down `Ctrl+C` key combination.
|
226
241
|
|
227
|
-
### Add/remove coins
|
242
|
+
### 4.2 Add/remove coins
|
228
243
|
|
229
244
|
**Coinpare** allows you to easily add and remove individual coins to and from your holdings portfolio.
|
230
245
|
|
@@ -254,6 +269,19 @@ Finally, if you wish to clear all your holdings and start again use `--clear` fl
|
|
254
269
|
$ coinpare holdings --clear
|
255
270
|
```
|
256
271
|
|
272
|
+
### 4.3 Pie charts
|
273
|
+
|
274
|
+
By default holdings are displayed in a table format. Alternatively, you can view your portfolio in a pie chart
|
275
|
+
using the `--pie` or `-p` option which optionally accepts pie chart radius value:
|
276
|
+
|
277
|
+
```bash
|
278
|
+
$ coinpare holdings --pie
|
279
|
+
```
|
280
|
+
|
281
|
+
An example output:
|
282
|
+
|
283
|
+
![HoldingsAsPieChart](https://github.com/piotrmurach/coinpare/raw/master/assets/coinpare_holdings_pie_charts.png)
|
284
|
+
|
257
285
|
## Development
|
258
286
|
|
259
287
|
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
data/coinpare.gemspec
CHANGED
@@ -13,21 +13,24 @@ Gem::Specification.new do |spec|
|
|
13
13
|
spec.description = %q{Compare cryptocurrency trading data across multiple exchanges and blockchains.}
|
14
14
|
spec.homepage = "https://github.com/piotrmurach/coinpare"
|
15
15
|
|
16
|
-
spec.files =
|
17
|
-
|
18
|
-
|
16
|
+
spec.files = Dir['lib/**/*']
|
17
|
+
spec.files += Dir['bin/*', 'coinpare.gemspec']
|
18
|
+
spec.files += Dir['README.md', 'CHANGELOG.md', 'LICENSE.txt', 'Rakefile']
|
19
19
|
spec.bindir = "exe"
|
20
|
-
spec.executables =
|
20
|
+
spec.executables = "coinpare"
|
21
21
|
spec.require_paths = ["lib"]
|
22
22
|
|
23
|
-
spec.
|
24
|
-
|
25
|
-
spec.add_dependency "tty-
|
26
|
-
spec.add_dependency "tty-
|
27
|
-
spec.add_dependency "tty-
|
28
|
-
spec.add_dependency "tty-
|
29
|
-
spec.add_dependency "tty-
|
30
|
-
spec.add_dependency "tty-
|
23
|
+
spec.required_ruby_version = '>= 2.0.0'
|
24
|
+
|
25
|
+
spec.add_dependency "tty-color", "~> 0.4"
|
26
|
+
spec.add_dependency "tty-config", "~> 0.3.0"
|
27
|
+
spec.add_dependency "tty-cursor", "~> 0.6.0"
|
28
|
+
spec.add_dependency "tty-editor", "~> 0.5"
|
29
|
+
spec.add_dependency "tty-font", "~> 0.3"
|
30
|
+
spec.add_dependency "tty-pager", "~> 0.12"
|
31
|
+
spec.add_dependency "tty-pie", "~> 0.2.0"
|
32
|
+
spec.add_dependency "tty-prompt", "~> 0.18"
|
33
|
+
spec.add_dependency "tty-spinner", "~> 0.9"
|
31
34
|
spec.add_dependency "tty-table", "~> 0.10.0"
|
32
35
|
spec.add_dependency "pastel", "~> 0.7.2"
|
33
36
|
spec.add_dependency "thor", "~> 0.20.0"
|
@@ -35,8 +38,8 @@ Gem::Specification.new do |spec|
|
|
35
38
|
spec.add_dependency "timers", "~> 4.1.2"
|
36
39
|
|
37
40
|
spec.add_development_dependency "bundler", "~> 1.16"
|
38
|
-
spec.add_development_dependency "rake", "~>
|
41
|
+
spec.add_development_dependency "rake", "~> 12.0"
|
39
42
|
spec.add_development_dependency "rspec", "~> 3.0"
|
40
|
-
spec.add_development_dependency "webmock", "~> 3.
|
43
|
+
spec.add_development_dependency "webmock", "~> 3.5"
|
41
44
|
spec.add_development_dependency "timecop", "~> 0.9.1"
|
42
45
|
end
|
data/lib/coinpare/cli.rb
CHANGED
@@ -76,7 +76,7 @@ module Coinpare
|
|
76
76
|
|
77
77
|
> $ coinpare holdings --exchange coinbase --base USD
|
78
78
|
DESC
|
79
|
-
method_option :add, type: :boolean,
|
79
|
+
method_option :add, aliases: '-a', type: :boolean,
|
80
80
|
desc: "Add a new coin without altering any existhing holdings"
|
81
81
|
method_option :base, aliases: '-b', type: :string,
|
82
82
|
desc: 'The currency symbol to convert into',
|
@@ -89,6 +89,9 @@ module Coinpare
|
|
89
89
|
desc: 'Name of exchange', banner: 'NAME'
|
90
90
|
method_option :help, aliases: '-h', type: :boolean,
|
91
91
|
desc: 'Display usage information'
|
92
|
+
method_option :pie, aliases: '-p', type: :string,
|
93
|
+
desc: 'Display data in a pie chart format',
|
94
|
+
banner: 'RADIUS'
|
92
95
|
method_option :remove, type: :boolean,
|
93
96
|
desc: "Remove the given coin(s) from holdings"
|
94
97
|
method_option :watch, aliases: '-w', banner: 'N',
|
@@ -22,7 +22,7 @@ module Coinpare
|
|
22
22
|
end
|
23
23
|
|
24
24
|
def execute(output: $stdout)
|
25
|
-
pager = TTY::Pager
|
25
|
+
pager = TTY::Pager.new(output: output)
|
26
26
|
@spinner.auto_spin
|
27
27
|
|
28
28
|
if @options['watch']
|
@@ -66,7 +66,13 @@ module Coinpare
|
|
66
66
|
|
67
67
|
def print_results(table, output, pager)
|
68
68
|
output.puts banner(@options)
|
69
|
-
|
69
|
+
lines = banner(@options).lines.size + 1 + (table.rows_size + 3)
|
70
|
+
rendered = table.render(:unicode, padding: [0, 1], alignment: :right)
|
71
|
+
if lines >= screen.height
|
72
|
+
pager.page rendered
|
73
|
+
else
|
74
|
+
output.print rendered
|
75
|
+
end
|
70
76
|
output.puts
|
71
77
|
end
|
72
78
|
|
@@ -6,6 +6,7 @@ require 'tty-config'
|
|
6
6
|
require 'tty-prompt'
|
7
7
|
require 'tty-spinner'
|
8
8
|
require 'tty-table'
|
9
|
+
require 'tty-pie'
|
9
10
|
require 'timers'
|
10
11
|
|
11
12
|
require_relative '../command'
|
@@ -14,6 +15,8 @@ require_relative '../fetcher'
|
|
14
15
|
module Coinpare
|
15
16
|
module Commands
|
16
17
|
class Holdings < Coinpare::Command
|
18
|
+
DEFAULT_PIE_RADIUS = 6
|
19
|
+
|
17
20
|
def initialize(options)
|
18
21
|
@options = options
|
19
22
|
@pastel = Pastel.new
|
@@ -25,7 +28,7 @@ module Coinpare
|
|
25
28
|
end
|
26
29
|
|
27
30
|
def execute(input: $stdin, output: $stdout)
|
28
|
-
config_saved = config.
|
31
|
+
config_saved = config.exist?
|
29
32
|
if config_saved && @options['edit']
|
30
33
|
editor.open(config.source_file)
|
31
34
|
return
|
@@ -105,14 +108,22 @@ module Coinpare
|
|
105
108
|
overridden_settings['base'].upcase,
|
106
109
|
overridden_settings)
|
107
110
|
return unless response
|
108
|
-
table =
|
111
|
+
table = if @options['pie']
|
112
|
+
setup_table_with_pies(response['RAW'], response['DISPLAY'])
|
113
|
+
else
|
114
|
+
setup_table(response['RAW'], response['DISPLAY'])
|
115
|
+
end
|
109
116
|
|
110
117
|
@spinner.stop
|
111
118
|
|
112
|
-
lines = banner(overridden_settings).lines.size + 1 + table.rows_size + 3
|
119
|
+
lines = banner(overridden_settings).lines.size + 1 + (table.rows_size + 3)
|
113
120
|
clear_output(output, lines) do
|
114
121
|
output.puts banner(overridden_settings)
|
115
|
-
|
122
|
+
if @options['pie']
|
123
|
+
output.puts table.render(:unicode, padding: [0, 2])
|
124
|
+
else
|
125
|
+
output.puts table.render(:unicode, padding: [0, 1], alignment: :right)
|
126
|
+
end
|
116
127
|
end
|
117
128
|
end
|
118
129
|
|
@@ -127,26 +138,31 @@ module Coinpare
|
|
127
138
|
prefix: "[#{add_color('c', :yellow)}] ",
|
128
139
|
input: input, output: output,
|
129
140
|
interrupt: -> { puts; exit 1 },
|
130
|
-
enable_color: !@options['no-color'],
|
131
|
-
|
141
|
+
enable_color: !@options['no-color'],
|
142
|
+
clear: true
|
143
|
+
)
|
144
|
+
prompt.on(:keypress) { |event|
|
145
|
+
prompt.trigger(:keydown) if event.value == 'j'
|
146
|
+
prompt.trigger(:keyup) if event.value == 'k'
|
147
|
+
}
|
132
148
|
prompt
|
133
149
|
end
|
134
150
|
|
135
151
|
def ask_coin
|
136
152
|
-> (prompt) do
|
137
153
|
key('name').ask('What coin do you own?') do |q|
|
138
|
-
q.required true
|
139
154
|
q.default 'BTC'
|
155
|
+
q.required(true, 'You need to provide a coin')
|
140
156
|
q.validate(/\w{2,}/, 'Currency can only be chars.')
|
141
157
|
q.convert ->(coin) { coin.upcase }
|
142
158
|
end
|
143
159
|
key('amount').ask('What amount?') do |q|
|
144
|
-
q.required
|
160
|
+
q.required(true, 'You need to provide an amount')
|
145
161
|
q.validate(/[\d.]+/, 'Invalid amount provided')
|
146
162
|
q.convert ->(am) { am.to_f }
|
147
163
|
end
|
148
164
|
key('price').ask('At what price per coin?') do |q|
|
149
|
-
q.required
|
165
|
+
q.required(true, 'You need to provide a price')
|
150
166
|
q.validate(/[\d.]+/, 'Invalid prince provided')
|
151
167
|
q.convert ->(p) { p.to_f }
|
152
168
|
end
|
@@ -208,11 +224,71 @@ module Coinpare
|
|
208
224
|
data
|
209
225
|
end
|
210
226
|
|
227
|
+
def create_pie_charts(raw_data, display_data)
|
228
|
+
colors = %i[yellow blue green cyan magenta red]
|
229
|
+
radius = @options['pie'].to_i > 0 ? @options['pie'].to_i : DEFAULT_PIE_RADIUS
|
230
|
+
base = @options.fetch('base', config.fetch('settings', 'base')).upcase
|
231
|
+
to_symbol = nil
|
232
|
+
past_data = []
|
233
|
+
curr_data = []
|
234
|
+
|
235
|
+
config.fetch('holdings').each do |coin|
|
236
|
+
coin_data = raw_data[coin['name']][base]
|
237
|
+
to_symbol = display_data[coin['name']][base]['TOSYMBOL']
|
238
|
+
past_price = coin['amount'] * coin['price']
|
239
|
+
curr_price = coin['amount'] * coin_data['PRICE']
|
240
|
+
|
241
|
+
past_data << { name: coin['name'], value: past_price }
|
242
|
+
curr_data << { name: coin['name'], value: curr_price }
|
243
|
+
end
|
244
|
+
|
245
|
+
options = {
|
246
|
+
colors: !@options['no-color'] && colors,
|
247
|
+
radius: radius,
|
248
|
+
legend: {
|
249
|
+
left: 2,
|
250
|
+
format: "%<label>s %<name>s #{to_symbol} %<currency>s (%<percent>.0f%%)",
|
251
|
+
precision: 2
|
252
|
+
}
|
253
|
+
}
|
254
|
+
|
255
|
+
[
|
256
|
+
TTY::Pie.new(options.merge(data: past_data)),
|
257
|
+
TTY::Pie.new(options.merge(data: curr_data)),
|
258
|
+
to_symbol
|
259
|
+
]
|
260
|
+
end
|
261
|
+
|
262
|
+
def setup_table_with_pies(raw_data, display_data)
|
263
|
+
past_pie, curr_pie, to_symbol = *create_pie_charts(raw_data, display_data)
|
264
|
+
|
265
|
+
total_change = curr_pie.total - past_pie.total
|
266
|
+
arrow = pick_arrow(total_change)
|
267
|
+
|
268
|
+
header_past = "Total Price (#{to_symbol} #{number_to_currency(round_to(past_pie.total))})"
|
269
|
+
header_curr = [
|
270
|
+
"Total Current Price (#{to_symbol} #{number_to_currency(round_to(curr_pie.total))}) ",
|
271
|
+
add_color("#{arrow} #{to_symbol} #{number_to_currency(round_to(total_change))}", pick_color(total_change)),
|
272
|
+
].join
|
273
|
+
|
274
|
+
table = TTY::Table.new(
|
275
|
+
header: [
|
276
|
+
{value: header_past, alignment: :center},
|
277
|
+
{value: header_curr, alignment: :center}
|
278
|
+
]
|
279
|
+
)
|
280
|
+
past_pie.to_s.split("\n").zip(curr_pie.to_s.split("\n")).each do |past_part, curr_part|
|
281
|
+
table << [past_part, curr_part]
|
282
|
+
end
|
283
|
+
table
|
284
|
+
end
|
285
|
+
|
211
286
|
def setup_table(raw_data, display_data)
|
212
287
|
base = @options.fetch('base', config.fetch('settings', 'base')).upcase
|
213
288
|
total_buy = 0
|
214
289
|
total = 0
|
215
290
|
to_symbol = nil
|
291
|
+
|
216
292
|
table = TTY::Table.new(header: [
|
217
293
|
{ value: 'Coin', alignment: :left },
|
218
294
|
'Amount',
|
@@ -252,7 +328,7 @@ module Coinpare
|
|
252
328
|
arrow = pick_arrow(total_change)
|
253
329
|
|
254
330
|
table << [
|
255
|
-
{ value: add_color('ALL', :cyan), alignment: :left}, '-', '-',
|
331
|
+
{ value: add_color('ALL', :cyan), alignment: :left }, '-', '-',
|
256
332
|
"#{to_symbol} #{number_to_currency(round_to(total_buy))}", '-',
|
257
333
|
add_color("#{to_symbol} #{number_to_currency(round_to(total))}", pick_color(total_change)),
|
258
334
|
add_color("#{arrow} #{to_symbol} #{number_to_currency(round_to(total_change))}", pick_color(total_change)),
|
@@ -22,7 +22,7 @@ module Coinpare
|
|
22
22
|
end
|
23
23
|
|
24
24
|
def execute(input: $stdin, output: $stdout)
|
25
|
-
pager = TTY::Pager
|
25
|
+
pager = TTY::Pager.new(output: output)
|
26
26
|
@spinner.auto_spin
|
27
27
|
|
28
28
|
if @options['watch']
|
@@ -62,7 +62,13 @@ module Coinpare
|
|
62
62
|
|
63
63
|
def print_results(table, output, pager)
|
64
64
|
output.puts banner
|
65
|
-
|
65
|
+
lines = banner.lines.size + 1 + (table.rows_size + 3)
|
66
|
+
rendered = table.render(:unicode, padding: [0, 1], alignment: :right)
|
67
|
+
if lines >= screen.height
|
68
|
+
pager.page rendered
|
69
|
+
else
|
70
|
+
output.print rendered
|
71
|
+
end
|
66
72
|
output.puts
|
67
73
|
end
|
68
74
|
|
data/lib/coinpare/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: coinpare
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Piotr Murach
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-01-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: tty-color
|
@@ -16,112 +16,126 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 0.4
|
19
|
+
version: '0.4'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 0.4
|
26
|
+
version: '0.4'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: tty-config
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 0.
|
33
|
+
version: 0.3.0
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 0.
|
40
|
+
version: 0.3.0
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: tty-cursor
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: 0.
|
47
|
+
version: 0.6.0
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: 0.
|
54
|
+
version: 0.6.0
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: tty-editor
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: 0.
|
61
|
+
version: '0.5'
|
62
62
|
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: 0.
|
68
|
+
version: '0.5'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: tty-font
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
73
|
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: 0.
|
75
|
+
version: '0.3'
|
76
76
|
type: :runtime
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: 0.
|
82
|
+
version: '0.3'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: tty-pager
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
87
|
- - "~>"
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version: 0.
|
89
|
+
version: '0.12'
|
90
|
+
type: :runtime
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0.12'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: tty-pie
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - "~>"
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: 0.2.0
|
90
104
|
type: :runtime
|
91
105
|
prerelease: false
|
92
106
|
version_requirements: !ruby/object:Gem::Requirement
|
93
107
|
requirements:
|
94
108
|
- - "~>"
|
95
109
|
- !ruby/object:Gem::Version
|
96
|
-
version: 0.
|
110
|
+
version: 0.2.0
|
97
111
|
- !ruby/object:Gem::Dependency
|
98
112
|
name: tty-prompt
|
99
113
|
requirement: !ruby/object:Gem::Requirement
|
100
114
|
requirements:
|
101
115
|
- - "~>"
|
102
116
|
- !ruby/object:Gem::Version
|
103
|
-
version: 0.
|
117
|
+
version: '0.18'
|
104
118
|
type: :runtime
|
105
119
|
prerelease: false
|
106
120
|
version_requirements: !ruby/object:Gem::Requirement
|
107
121
|
requirements:
|
108
122
|
- - "~>"
|
109
123
|
- !ruby/object:Gem::Version
|
110
|
-
version: 0.
|
124
|
+
version: '0.18'
|
111
125
|
- !ruby/object:Gem::Dependency
|
112
126
|
name: tty-spinner
|
113
127
|
requirement: !ruby/object:Gem::Requirement
|
114
128
|
requirements:
|
115
129
|
- - "~>"
|
116
130
|
- !ruby/object:Gem::Version
|
117
|
-
version: 0.
|
131
|
+
version: '0.9'
|
118
132
|
type: :runtime
|
119
133
|
prerelease: false
|
120
134
|
version_requirements: !ruby/object:Gem::Requirement
|
121
135
|
requirements:
|
122
136
|
- - "~>"
|
123
137
|
- !ruby/object:Gem::Version
|
124
|
-
version: 0.
|
138
|
+
version: '0.9'
|
125
139
|
- !ruby/object:Gem::Dependency
|
126
140
|
name: tty-table
|
127
141
|
requirement: !ruby/object:Gem::Requirement
|
@@ -212,14 +226,14 @@ dependencies:
|
|
212
226
|
requirements:
|
213
227
|
- - "~>"
|
214
228
|
- !ruby/object:Gem::Version
|
215
|
-
version: '
|
229
|
+
version: '12.0'
|
216
230
|
type: :development
|
217
231
|
prerelease: false
|
218
232
|
version_requirements: !ruby/object:Gem::Requirement
|
219
233
|
requirements:
|
220
234
|
- - "~>"
|
221
235
|
- !ruby/object:Gem::Version
|
222
|
-
version: '
|
236
|
+
version: '12.0'
|
223
237
|
- !ruby/object:Gem::Dependency
|
224
238
|
name: rspec
|
225
239
|
requirement: !ruby/object:Gem::Requirement
|
@@ -240,14 +254,14 @@ dependencies:
|
|
240
254
|
requirements:
|
241
255
|
- - "~>"
|
242
256
|
- !ruby/object:Gem::Version
|
243
|
-
version: '3.
|
257
|
+
version: '3.5'
|
244
258
|
type: :development
|
245
259
|
prerelease: false
|
246
260
|
version_requirements: !ruby/object:Gem::Requirement
|
247
261
|
requirements:
|
248
262
|
- - "~>"
|
249
263
|
- !ruby/object:Gem::Version
|
250
|
-
version: '3.
|
264
|
+
version: '3.5'
|
251
265
|
- !ruby/object:Gem::Dependency
|
252
266
|
name: timecop
|
253
267
|
requirement: !ruby/object:Gem::Requirement
|
@@ -270,12 +284,7 @@ executables:
|
|
270
284
|
extensions: []
|
271
285
|
extra_rdoc_files: []
|
272
286
|
files:
|
273
|
-
- ".gitignore"
|
274
|
-
- ".rspec"
|
275
|
-
- ".travis.yml"
|
276
287
|
- CHANGELOG.md
|
277
|
-
- CODE_OF_CONDUCT.md
|
278
|
-
- Gemfile
|
279
288
|
- LICENSE.txt
|
280
289
|
- README.md
|
281
290
|
- Rakefile
|
@@ -286,7 +295,6 @@ files:
|
|
286
295
|
- lib/coinpare.rb
|
287
296
|
- lib/coinpare/cli.rb
|
288
297
|
- lib/coinpare/command.rb
|
289
|
-
- lib/coinpare/commands/.gitkeep
|
290
298
|
- lib/coinpare/commands/coins.rb
|
291
299
|
- lib/coinpare/commands/holdings.rb
|
292
300
|
- lib/coinpare/commands/markets.rb
|
@@ -304,7 +312,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
304
312
|
requirements:
|
305
313
|
- - ">="
|
306
314
|
- !ruby/object:Gem::Version
|
307
|
-
version:
|
315
|
+
version: 2.0.0
|
308
316
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
309
317
|
requirements:
|
310
318
|
- - ">="
|
data/.gitignore
DELETED
data/.rspec
DELETED
data/.travis.yml
DELETED
@@ -1,34 +0,0 @@
|
|
1
|
-
---
|
2
|
-
env:
|
3
|
-
global:
|
4
|
-
- CC_TEST_REPORTER_ID=3d63f370290deb418d6a0f63aeb7f7785644b0ed44d576878e1b710e352efa0a
|
5
|
-
language: ruby
|
6
|
-
sudo: false
|
7
|
-
cache: bundler
|
8
|
-
before_install: "gem update bundler"
|
9
|
-
before_script:
|
10
|
-
- curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
|
11
|
-
- chmod +x ./cc-test-reporter
|
12
|
-
- ./cc-test-reporter before-build
|
13
|
-
script: "bundle exec rake ci"
|
14
|
-
after_script:
|
15
|
-
- ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT
|
16
|
-
rvm:
|
17
|
-
- 2.0.0
|
18
|
-
- 2.1.10
|
19
|
-
- 2.2.8
|
20
|
-
- 2.3.6
|
21
|
-
- 2.4.3
|
22
|
-
- 2.5.1
|
23
|
-
- ruby-head
|
24
|
-
- jruby-9.1.1.0
|
25
|
-
- jruby-head
|
26
|
-
matrix:
|
27
|
-
allow_failures:
|
28
|
-
- rvm: 2.5.1
|
29
|
-
- rvm: ruby-head
|
30
|
-
- rvm: jruby-9.1.1.0
|
31
|
-
- rvm: jruby-head
|
32
|
-
fast_finish: true
|
33
|
-
branches:
|
34
|
-
only: master
|
data/CODE_OF_CONDUCT.md
DELETED
@@ -1,74 +0,0 @@
|
|
1
|
-
# Contributor Covenant Code of Conduct
|
2
|
-
|
3
|
-
## Our Pledge
|
4
|
-
|
5
|
-
In the interest of fostering an open and welcoming environment, we as
|
6
|
-
contributors and maintainers pledge to making participation in our project and
|
7
|
-
our community a harassment-free experience for everyone, regardless of age, body
|
8
|
-
size, disability, ethnicity, gender identity and expression, level of experience,
|
9
|
-
nationality, personal appearance, race, religion, or sexual identity and
|
10
|
-
orientation.
|
11
|
-
|
12
|
-
## Our Standards
|
13
|
-
|
14
|
-
Examples of behavior that contributes to creating a positive environment
|
15
|
-
include:
|
16
|
-
|
17
|
-
* Using welcoming and inclusive language
|
18
|
-
* Being respectful of differing viewpoints and experiences
|
19
|
-
* Gracefully accepting constructive criticism
|
20
|
-
* Focusing on what is best for the community
|
21
|
-
* Showing empathy towards other community members
|
22
|
-
|
23
|
-
Examples of unacceptable behavior by participants include:
|
24
|
-
|
25
|
-
* The use of sexualized language or imagery and unwelcome sexual attention or
|
26
|
-
advances
|
27
|
-
* Trolling, insulting/derogatory comments, and personal or political attacks
|
28
|
-
* Public or private harassment
|
29
|
-
* Publishing others' private information, such as a physical or electronic
|
30
|
-
address, without explicit permission
|
31
|
-
* Other conduct which could reasonably be considered inappropriate in a
|
32
|
-
professional setting
|
33
|
-
|
34
|
-
## Our Responsibilities
|
35
|
-
|
36
|
-
Project maintainers are responsible for clarifying the standards of acceptable
|
37
|
-
behavior and are expected to take appropriate and fair corrective action in
|
38
|
-
response to any instances of unacceptable behavior.
|
39
|
-
|
40
|
-
Project maintainers have the right and responsibility to remove, edit, or
|
41
|
-
reject comments, commits, code, wiki edits, issues, and other contributions
|
42
|
-
that are not aligned to this Code of Conduct, or to ban temporarily or
|
43
|
-
permanently any contributor for other behaviors that they deem inappropriate,
|
44
|
-
threatening, offensive, or harmful.
|
45
|
-
|
46
|
-
## Scope
|
47
|
-
|
48
|
-
This Code of Conduct applies both within project spaces and in public spaces
|
49
|
-
when an individual is representing the project or its community. Examples of
|
50
|
-
representing a project or community include using an official project e-mail
|
51
|
-
address, posting via an official social media account, or acting as an appointed
|
52
|
-
representative at an online or offline event. Representation of a project may be
|
53
|
-
further defined and clarified by project maintainers.
|
54
|
-
|
55
|
-
## Enforcement
|
56
|
-
|
57
|
-
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
58
|
-
reported by contacting the project team at [email]. All
|
59
|
-
complaints will be reviewed and investigated and will result in a response that
|
60
|
-
is deemed necessary and appropriate to the circumstances. The project team is
|
61
|
-
obligated to maintain confidentiality with regard to the reporter of an incident.
|
62
|
-
Further details of specific enforcement policies may be posted separately.
|
63
|
-
|
64
|
-
Project maintainers who do not follow or enforce the Code of Conduct in good
|
65
|
-
faith may face temporary or permanent repercussions as determined by other
|
66
|
-
members of the project's leadership.
|
67
|
-
|
68
|
-
## Attribution
|
69
|
-
|
70
|
-
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
71
|
-
available at [http://contributor-covenant.org/version/1/4][version]
|
72
|
-
|
73
|
-
[homepage]: http://contributor-covenant.org
|
74
|
-
[version]: http://contributor-covenant.org/version/1/4/
|
data/Gemfile
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
source "https://rubygems.org"
|
2
|
-
|
3
|
-
git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
|
4
|
-
|
5
|
-
gemspec
|
6
|
-
|
7
|
-
group :test do
|
8
|
-
gem 'simplecov', '~> 0.14.1'
|
9
|
-
end
|
10
|
-
|
11
|
-
group :metrics do
|
12
|
-
gem 'yard', '~> 0.9.12'
|
13
|
-
gem 'yardstick', '~> 0.9.9'
|
14
|
-
end
|
@@ -1 +0,0 @@
|
|
1
|
-
#
|