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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ae8ae8c652d00d36462bc6061152f8fc0ace6a1ef2a60829454e36a13724c61b
4
- data.tar.gz: 57c8faa58ecee7055cd551cd04c22ec716741ffe4efdc8d1a2c039dd63fe6392
3
+ metadata.gz: c5da8f2224f0f5cbdc98b4e1d7a8a6a95575953b125cd2c3cf2c28655ed61108
4
+ data.tar.gz: c6bb2e718e250eb2c404198e635ab4efb5559f1ff0f2afffc476158a94c04d7e
5
5
  SHA512:
6
- metadata.gz: 4b1a3afd03c2ee8a129ed679693f4c632c64221297ae2467194c41dad11baa1fb579a4288871613d0afe4bb759a8859b4a4771bb085438c072a156248e336532
7
- data.tar.gz: 89939e8bceaf23bcd3e94317de9ed73231da669d339c828a06932d3864fe3b2a268fba435498b1a642e00b3411711f36577742662985e99145f44f448a976ad2
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 box-shadow
76
+ cani use grid-layout
77
77
 
78
78
  # or:
79
- # cani use 'box shadow'
80
- # cani use 'boxshadow'
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
  ![Cani use box-shadow support table](/assets/cani-feature-table.png)
86
86
 
87
87
  The table is responsive and will show browsers that fit in available space, everything else wraps accordingly.
88
- The 3-line high era in the middle resembles the "current era" of most used browsers. 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.
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
+ ![Cani use box-shadow support table](/assets/cani-feature-table-compressed.png)
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 supported features in chrome 70
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
- num_chunked = feature.notes_by_num.each_with_object({}) { |(k, nt), h| h[k] = nt.chars.each_slice(outer_width - 5).map(&:join).map(&:strip) }
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
@@ -1,3 +1,3 @@
1
1
  module Cani
2
- VERSION = "0.4.2"
2
+ VERSION = "0.5.0"
3
3
  end
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.4.2
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sidney Liebrand