cani 0.4.2 → 0.5.0
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/README.md +13 -7
- data/lib/cani/api/feature/viewer.rb +15 -1
- data/lib/cani/config.rb +7 -1
- data/lib/cani/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c5da8f2224f0f5cbdc98b4e1d7a8a6a95575953b125cd2c3cf2c28655ed61108
|
4
|
+
data.tar.gz: c6bb2e718e250eb2c404198e635ab4efb5559f1ff0f2afffc476158a94c04d7e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bef86b81aae7fb02b08b5c977e00b73a79ee96e7e72671d72f62d4063c0ee6a19b5e109dd5180e2eb4975275739c61d8d797ca902b87b6a11dcc85b4d9bede19
|
7
|
+
data.tar.gz: 5380aa3abf603f177676595e95bb04c0c9d641d96db4a5d4e3a03246513a66a9a7222bc17595d5add80c01b457003a7c98b97e1121028a035bb2f727d93e19b5
|
data/README.md
CHANGED
@@ -59,7 +59,7 @@ Cani supports the following actions:
|
|
59
59
|
- [`update`](#update) - force update data and completions
|
60
60
|
- [`install_completions`](#install_completions) - install shell completions
|
61
61
|
- [`purge`](#purge) - purge files and directories created by `cani`
|
62
|
-
- [`edit`](#edit) - edit the default configuration file
|
62
|
+
- [`edit`](#edit) - edit the default configuration file with `$EDITOR`
|
63
63
|
|
64
64
|
### use
|
65
65
|
|
@@ -73,11 +73,11 @@ each individual browser's support on a single row.
|
|
73
73
|
This command may be invoked with a feature and supports <kbd>tab</kbd> completion in `bash`, `zsh` and `fish`:
|
74
74
|
|
75
75
|
```sh
|
76
|
-
cani use
|
76
|
+
cani use grid-layout
|
77
77
|
|
78
78
|
# or:
|
79
|
-
# cani use '
|
80
|
-
# cani use '
|
79
|
+
# cani use 'grid layout'
|
80
|
+
# cani use 'gridlayout'
|
81
81
|
```
|
82
82
|
|
83
83
|
The above command will show the following table:
|
@@ -85,8 +85,13 @@ The above command will show the following table:
|
|
85
85
|

|
86
86
|
|
87
87
|
The table is responsive and will show browsers that fit in available space, everything else wraps accordingly.
|
88
|
-
The
|
89
|
-
At the bottom there is a legend that provides an abbreviated status color overview.
|
88
|
+
The current era has a light-black border. Browser versions with less than `0.5%` usage aren't shown.
|
89
|
+
At the bottom there is a legend that provides an abbreviated status color overview. Below that, additional notes can be found.
|
90
|
+
Notes are shown based on relevant and visible browsers, all other notes are hidden (this can be changed in the config).
|
91
|
+
|
92
|
+
If your display height is `<= 40` lines, era's will be displayed in a more compact manner while still allowing space for notes:
|
93
|
+
|
94
|
+

|
90
95
|
|
91
96
|
### show
|
92
97
|
|
@@ -98,6 +103,7 @@ Show a list of browsers. Selecting a browser will take you to the versions for t
|
|
98
103
|
Selecting a version shows the final window with feature support for that specific browser version.
|
99
104
|
Navigating to the previous window is possible by pressing <kbd>escape</kbd>, this will move you up one level.
|
100
105
|
When <kbd>escape</kbd> is pressed at the browser selection menu, the command will exit.
|
106
|
+
Selecting a feature using <kbd>enter</kbd> will show you the **current** support table for that feature **regardless** of selected version.
|
101
107
|
|
102
108
|
This command may be invoked with a browser and / or version and supports <kbd>tab</kbd> completion in `bash`, `zsh` and `fish`:
|
103
109
|
|
@@ -105,7 +111,7 @@ This command may be invoked with a browser and / or version and supports <kbd>ta
|
|
105
111
|
# show all versions of chrome
|
106
112
|
cani show chr
|
107
113
|
|
108
|
-
# show all
|
114
|
+
# show all features with support level in chrome 70
|
109
115
|
cani show chr 70
|
110
116
|
```
|
111
117
|
|
@@ -160,8 +160,17 @@ module Cani
|
|
160
160
|
Curses.addstr status_format
|
161
161
|
end
|
162
162
|
|
163
|
+
# 'more or less' predict a height that is too small
|
164
|
+
# since we don't know the entire height but draw it line-by-line at the moment
|
163
165
|
compact_height = height <= 40
|
164
166
|
|
167
|
+
# by default, notes are only shown if visible in the actual table
|
168
|
+
# this means there might be more notes than actually displayed
|
169
|
+
# but this allows us to optimally use available space to display
|
170
|
+
# the most useful information to the user
|
171
|
+
# TODO: provide a config setting to disable this behaviour
|
172
|
+
notes_visible = []
|
173
|
+
|
165
174
|
# meaty part, loop through browsers to create
|
166
175
|
# the final feature table
|
167
176
|
browsers[0...viewable].each.with_index do |browser, x|
|
@@ -222,6 +231,7 @@ module Cani
|
|
222
231
|
end
|
223
232
|
|
224
233
|
if note_nums.any?
|
234
|
+
notes_visible.concat(note_nums).uniq!
|
225
235
|
Curses.setpos ey - top_pad, bx
|
226
236
|
Curses.attron(note_color(supp_type)) { Curses.addstr ' ' + note_nums.join(' ') }
|
227
237
|
end
|
@@ -269,7 +279,11 @@ module Cani
|
|
269
279
|
cy += 1
|
270
280
|
|
271
281
|
notes_chunked = feature.notes.map { |nt| nt.chars.each_slice(outer_width).map(&:join).map(&:strip) }
|
272
|
-
|
282
|
+
filter_vis = Cani.config.notes == 'relevant' ? notes_visible.map(&:to_s) : feature.notes_by_num.keys
|
283
|
+
|
284
|
+
num_chunked = feature.notes_by_num
|
285
|
+
.select { |(k, _)| filter_vis.include? k }
|
286
|
+
.each_with_object({}) { |(k, nt), h| h[k] = nt.chars.each_slice(outer_width - 5).map(&:join).map(&:strip) }
|
273
287
|
notes_total = (notes_chunked.map(&:size) + num_chunked.map(&:size)).reduce(0) { |total, add| total + add }
|
274
288
|
|
275
289
|
if height > cy + 2 && (notes_chunked.any? || num_chunked.any?)
|
data/lib/cani/config.rb
CHANGED
@@ -15,7 +15,8 @@ module Cani
|
|
15
15
|
# usage settings
|
16
16
|
'versions' => 1,
|
17
17
|
'browsers' => %w[ie edge chrome firefox safari ios_saf opera android bb],
|
18
|
-
'navigate' => 'always'
|
18
|
+
'navigate' => 'always',
|
19
|
+
'notes' => 'relevant'
|
19
20
|
}.freeze
|
20
21
|
|
21
22
|
def initialize(**opts)
|
@@ -95,6 +96,11 @@ module Cani
|
|
95
96
|
f << "# * 'always' - always navigate back to the previous menu, exit only at root menu with <escape>\n"
|
96
97
|
f << "# * 'forward' - only allow navigating forward and backwards upto the menu that cani was initially open\n"
|
97
98
|
f << "navigate: #{navigate}\n\n"
|
99
|
+
f << "# the notes property defines how notes should be displayed\n"
|
100
|
+
f << "# there are two different modes:\n"
|
101
|
+
f << "# * 'all' - show all notes, regardless of relevance\n"
|
102
|
+
f << "# * 'relevant' - show only relevant (visible in an era) notes\n"
|
103
|
+
f << "notes: #{notes}\n\n"
|
98
104
|
f << "# the \"versions\" key defines how many versions of support\n"
|
99
105
|
f << "# will be shown in the \"use\" command\n"
|
100
106
|
f << "# e.g. `-ie +edge` becomes `--ie ++edge` when this is set to 2, etc...\n"
|
data/lib/cani/version.rb
CHANGED