cani 0.5.0 → 0.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/bin/cani +7 -0
- data/lib/cani/api/feature/viewer.rb +27 -18
- data/lib/cani/version.rb +1 -1
- data/lib/cani.rb +3 -0
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d821ab62236b32025cd182c4c0196d1d8a4a707ea9a4308ef93347baba029c30
|
4
|
+
data.tar.gz: d12c12cb0bb5f6e91a40b7d9525642a5b5f4e78c7980b481ef03294061504b14
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: edab77a93d813b073ebb9acc9de3b130a5f8f4768f94b4ebb85c58f2efa2313fda1a22c0aaf15c9d73ab2d0bc4de01a38fe57402c11836729795baa5434b64f1
|
7
|
+
data.tar.gz: c246b07a7a08d79e42c76c632c48286c32d9bfe5907da3360f93ed42888ee405def686fc4ece30ff00d04e2f0d8aaa56d04d752faf2a7ad2c9bbd23cdbbba613
|
data/bin/cani
ADDED
@@ -173,18 +173,21 @@ module Cani
|
|
173
173
|
|
174
174
|
# meaty part, loop through browsers to create
|
175
175
|
# the final feature table
|
176
|
-
browsers
|
176
|
+
browsers.each.with_index do |browser, x|
|
177
177
|
# some set up to find the current era for each browser
|
178
178
|
# and creating a range around that to show past / coming support
|
179
179
|
era_idx = browser.most_popular_era_idx
|
180
180
|
era_range = (era_idx - (ERAS / 2.0).floor + 1)..(era_idx + (ERAS / 2.0).ceil)
|
181
181
|
bx = offset_x + x * col_width + x
|
182
182
|
by = offset_y + cy
|
183
|
+
do_draw = x < viewable
|
183
184
|
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
Curses.
|
185
|
+
if do_draw
|
186
|
+
# draw browser names
|
187
|
+
Curses.setpos by, bx
|
188
|
+
Curses.attron color(:header) do
|
189
|
+
Curses.addstr browser.name.tr('_', '.').center(col_width)
|
190
|
+
end
|
188
191
|
end
|
189
192
|
|
190
193
|
# accordingly increment current browser y for the table header (browser names)
|
@@ -204,7 +207,9 @@ module Cani
|
|
204
207
|
note_nums = feature.browser_note_nums.fetch(browser.name, {})
|
205
208
|
.fetch(era, [])
|
206
209
|
|
207
|
-
if is_current
|
210
|
+
break if (ey + (is_current ? 1 : bot_pad) + 1) >= height
|
211
|
+
|
212
|
+
if do_draw && is_current
|
208
213
|
Curses.setpos ey - top_pad - 1, bx - 1
|
209
214
|
Curses.attron(color(:era_border)) { Curses.addstr ' ' * (col_width + 2) }
|
210
215
|
|
@@ -214,26 +219,30 @@ module Cani
|
|
214
219
|
|
215
220
|
# only show visible / relevant browsers
|
216
221
|
if browser.usage[era].to_i >= 0.5 || (!era.empty? && cur_era >= era_idx)
|
217
|
-
|
218
|
-
|
219
|
-
|
222
|
+
if do_draw
|
223
|
+
((ey - top_pad)..(ey + (is_current ? 1 : bot_pad))).each do |ry|
|
224
|
+
txt = (bot_pad.zero? && !is_current) ? (ry >= ey + (is_current ? 1 : bot_pad) ? era.to_s : ' ')
|
225
|
+
: (ry == ey ? era.to_s : ' ')
|
220
226
|
|
221
|
-
|
222
|
-
|
227
|
+
Curses.setpos ry, bx
|
228
|
+
Curses.attron(colr) { Curses.addstr txt.center(col_width) }
|
223
229
|
|
224
|
-
|
225
|
-
|
226
|
-
|
230
|
+
if is_current
|
231
|
+
Curses.setpos ry, bx - 1
|
232
|
+
Curses.attron(color(:era_border)) { Curses.addstr ' ' }
|
227
233
|
|
228
|
-
|
229
|
-
|
234
|
+
Curses.setpos ry, offset_x + table_width + 2
|
235
|
+
Curses.attron(color(:era_border)) { Curses.addstr ' ' }
|
236
|
+
end
|
230
237
|
end
|
231
238
|
end
|
232
239
|
|
233
240
|
if note_nums.any?
|
234
241
|
notes_visible.concat(note_nums).uniq!
|
235
|
-
|
236
|
-
|
242
|
+
if do_draw
|
243
|
+
Curses.setpos ey - top_pad, bx
|
244
|
+
Curses.attron(note_color(supp_type)) { Curses.addstr ' ' + note_nums.join(' ') }
|
245
|
+
end
|
237
246
|
end
|
238
247
|
end
|
239
248
|
end
|
data/lib/cani/version.rb
CHANGED
data/lib/cani.rb
CHANGED
@@ -55,6 +55,9 @@ module Cani
|
|
55
55
|
puts 'cani is dependent on fzf (https://github.com/junegunn/fzf) for the interactive TUI to work.'.light_black
|
56
56
|
puts 'without fzf, commands can still be piped to get the regular (colorless) output'.light_black
|
57
57
|
puts ''
|
58
|
+
puts 'Cani requires at least 20 lines and 40 cols to work properly, this is not a hard limit but'
|
59
|
+
puts 'below this width, long lines could wrap a lot and reduce visible information.'
|
60
|
+
puts ''
|
58
61
|
puts 'Usage:'.red
|
59
62
|
puts ' cani'.yellow + ' [COMMAND [ARGUMENTS]]'
|
60
63
|
puts ''
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cani
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sidney Liebrand
|
@@ -125,6 +125,7 @@ files:
|
|
125
125
|
- LICENSE.txt
|
126
126
|
- README.md
|
127
127
|
- Rakefile
|
128
|
+
- bin/cani
|
128
129
|
- bin/console
|
129
130
|
- bin/setup
|
130
131
|
- cani.gemspec
|