snibbets 2.0.33 → 2.0.35

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a04adb0bcd4439b3cd445b65bbfb4dc8494237cccca55fb6cc1a42c696e45864
4
- data.tar.gz: 25099f85f797910222a321dbebd3e0db84098071b964f6d93e0d6ba19ef456c5
3
+ metadata.gz: 52a6ea620e56135407c912002d9a91e4892ca290beefb8acc9f48322b3fe0ac4
4
+ data.tar.gz: 9048ea2234f47fc0d514a885ae8f3bfb9a763e3de7e6ec3be1c7c4986b5298da
5
5
  SHA512:
6
- metadata.gz: 7d06a635679db42ad3a53eb21b235e21d4057f189c77760edc373306909da795e306cb7c7992e564cc517831487620904485f2007f0631a6e55ba7c434606b95
7
- data.tar.gz: 6b0f69d918b04ead612de23ba5d7c0b0044a137da79efc24b3037caa26f0f4d63055270499a6716c3c52e3a6bebbe3b12875db4dafbb7a7de8003559d58765ec
6
+ metadata.gz: 11a0747b70dd570d10085fa9c3b722f9a56f49b24118c8b2236d0d5d6059c9137c51f364491093e4bfbec5c923b69bb032812e45e6ed96513a30e890c260110b
7
+ data.tar.gz: e6e0f630d72e5095618fc97134bc647322328c17d14b781d4d921bcca60df681e8c2ad2e5a84ae1f8dcf23b3f25338f12eea95db8e1c2ca44e956784aa5828cc
data/CHANGELOG.md CHANGED
@@ -1,3 +1,23 @@
1
+ ### 2.0.35
2
+
3
+ 2023-08-21 11:16
4
+
5
+ #### FIXED
6
+
7
+ - Mdfind returns nil on linux
8
+
9
+ ### 2.0.34
10
+
11
+ 2023-06-17 09:17
12
+
13
+ #### IMPROVED
14
+
15
+ - If a section of a snippet contains no code blocks, output the whole thing
16
+
17
+ #### FIXED
18
+
19
+ - Correct error if searching name only and no results are returned
20
+
1
21
  ### 2.0.33
2
22
 
3
23
  2023-04-26 10:23
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- snibbets (2.0.33)
4
+ snibbets (2.0.35)
5
5
  mdless (~> 1.0, >= 1.0.32)
6
6
  tty-reader (~> 0.9, >= 0.9.0)
7
7
  tty-which (~> 0.5, >= 0.5.0)
@@ -17,47 +17,50 @@ GEM
17
17
  gem-release (2.2.2)
18
18
  json (2.6.3)
19
19
  language_server-protocol (3.17.0.3)
20
- mdless (1.0.32)
20
+ lint_roller (1.0.0)
21
+ mdless (1.0.33)
21
22
  multi_json (1.15.0)
22
- parallel (1.22.1)
23
+ parallel (1.23.0)
23
24
  parse_gemspec (1.0.0)
24
25
  parse_gemspec-cli (1.0.0)
25
26
  multi_json
26
27
  parse_gemspec
27
28
  thor
28
- parser (3.2.2.0)
29
+ parser (3.2.2.3)
29
30
  ast (~> 2.4.1)
31
+ racc
32
+ racc (1.7.1)
30
33
  rainbow (3.1.1)
31
34
  rake (13.0.6)
32
35
  rdoc (6.3.3)
33
- regexp_parser (2.7.0)
36
+ regexp_parser (2.8.1)
34
37
  rexml (3.2.5)
35
38
  rspec (3.12.0)
36
39
  rspec-core (~> 3.12.0)
37
40
  rspec-expectations (~> 3.12.0)
38
41
  rspec-mocks (~> 3.12.0)
39
- rspec-core (3.12.1)
42
+ rspec-core (3.12.2)
40
43
  rspec-support (~> 3.12.0)
41
- rspec-expectations (3.12.2)
44
+ rspec-expectations (3.12.3)
42
45
  diff-lcs (>= 1.2.0, < 2.0)
43
46
  rspec-support (~> 3.12.0)
44
47
  rspec-mocks (3.12.5)
45
48
  diff-lcs (>= 1.2.0, < 2.0)
46
49
  rspec-support (~> 3.12.0)
47
50
  rspec-support (3.12.0)
48
- rubocop (1.48.1)
51
+ rubocop (1.52.1)
49
52
  json (~> 2.3)
50
53
  parallel (~> 1.10)
51
- parser (>= 3.2.0.0)
54
+ parser (>= 3.2.2.3)
52
55
  rainbow (>= 2.2.2, < 4.0)
53
56
  regexp_parser (>= 1.8, < 3.0)
54
57
  rexml (>= 3.2.5, < 4.0)
55
- rubocop-ast (>= 1.26.0, < 2.0)
58
+ rubocop-ast (>= 1.28.0, < 2.0)
56
59
  ruby-progressbar (~> 1.7)
57
60
  unicode-display_width (>= 2.4.0, < 3.0)
58
- rubocop-ast (1.28.0)
61
+ rubocop-ast (1.29.0)
59
62
  parser (>= 3.2.1.0)
60
- rubocop-performance (1.16.0)
63
+ rubocop-performance (1.18.0)
61
64
  rubocop (>= 1.7.0, < 2.0)
62
65
  rubocop-ast (>= 0.4.0)
63
66
  ruby-progressbar (1.13.0)
@@ -71,13 +74,20 @@ GEM
71
74
  terminal-table
72
75
  simplecov-html (0.12.3)
73
76
  simplecov_json_formatter (0.1.4)
74
- standard (1.26.0)
77
+ standard (1.29.0)
75
78
  language_server-protocol (~> 3.17.0.2)
76
- rubocop (~> 1.48.1)
77
- rubocop-performance (~> 1.16.0)
79
+ lint_roller (~> 1.0)
80
+ rubocop (~> 1.52.0)
81
+ standard-custom (~> 1.0.0)
82
+ standard-performance (~> 1.1.0)
83
+ standard-custom (1.0.1)
84
+ lint_roller (~> 1.0)
85
+ standard-performance (1.1.0)
86
+ lint_roller (~> 1.0)
87
+ rubocop-performance (~> 1.18.0)
78
88
  terminal-table (3.0.2)
79
89
  unicode-display_width (>= 1.1.1, < 3)
80
- thor (1.2.1)
90
+ thor (1.2.2)
81
91
  tty-cursor (0.7.1)
82
92
  tty-reader (0.9.0)
83
93
  tty-cursor (~> 0.7)
data/README.md CHANGED
@@ -68,7 +68,7 @@ To install Snibbets:
68
68
 
69
69
  gem install snibbets
70
70
 
71
- If you're using the system Ruby, you may need to use `sudo gem install snibbets`.
71
+ If you're using the system Ruby, use `gem install --user-install snibbets` instead.
72
72
 
73
73
  ### Configuration
74
74
 
@@ -159,7 +159,7 @@ Snibbet's implementation of Skylighting has limited but better-looking themes, a
159
159
  ### Usage
160
160
 
161
161
  ```
162
- Snibbets v2.0.33
162
+ Snibbets v2.0.35
163
163
 
164
164
  Usage: snibbets [options] query
165
165
  -a, --all If a file contains multiple snippets, output all of them (no menu)
@@ -169,7 +169,7 @@ module Snibbets
169
169
 
170
170
  next if lines.blocks.zero? && !notes
171
171
 
172
- title = if lines.count > 1 && lines[0] !~ /<block\d+>/ && lines[0] =~ /^ +/
172
+ title = if lines.count > 1 && lines[0] !~ /<block\d+>/
173
173
  lines.shift.strip.sub(/[.:]$/, '')
174
174
  else
175
175
  'Default snippet'
@@ -208,18 +208,27 @@ module Snibbets
208
208
  # becomes the title, code is gleaned from text between that and the
209
209
  # next ATX header (or end)
210
210
  sans_blocks, code_blocks = content.replace_blocks
211
-
212
- parts = if Snibbets.options[:all_notes]
213
- sans_blocks.split(/^#+/)
214
- elsif sans_blocks =~ /<block\d+>/
215
- sans_blocks.split(/\n/).each_with_object([]) do |line, arr|
216
- arr << line if line =~ /^#/ || line =~ /<block\d+>/
217
- end.join("\n").split(/^#+/)
218
- else
219
- sans_blocks.gsub(/\n{2,}/, "\n\n").split(/^#+/)
220
- end
221
-
222
- # parts.shift if parts.count > 1
211
+ parts = sans_blocks.gsub(/\n{2,}/, "\n\n").split(/^#+/)
212
+
213
+ unless Snibbets.options[:all_notes]
214
+ parts.map! do |part|
215
+ if part =~ /<block\d+>/
216
+ lines = part.split(/\n/)
217
+ title = lines.shift
218
+ out = [title.gsub(/(^#+|#+$)/, '').strip]
219
+ out.concat(lines.each_with_object([]) do |line, arr|
220
+ arr << line.gsub(/(^#+|#+$)/, '').strip if line =~ /^#/ || line =~ /<block\d+>/
221
+ end)
222
+ out.join("\n")
223
+ else
224
+ lines = part.split(/\n/)
225
+ title = lines.shift
226
+ out = title.nil? ? [] : [title.gsub(/(^#+|#+$)/, '').strip]
227
+ out.concat(lines)
228
+ out.join("\n")
229
+ end
230
+ end
231
+ end
223
232
 
224
233
  restore_blocks(parts, code_blocks)
225
234
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Snibbets
4
- VERSION = '2.0.33'
4
+ VERSION = '2.0.35'
5
5
  end
data/lib/snibbets.rb CHANGED
@@ -61,9 +61,7 @@ module Snibbets
61
61
  ag = TTY::Which.which('ag')
62
62
  ack = TTY::Which.which('ack')
63
63
  grep = TTY::Which.which('grep')
64
- if Snibbets.options[:name_only]
65
- nil
66
- elsif !rg.empty?
64
+ if !rg.empty?
67
65
  %(#{rg} -li --color=never --glob='*.#{ext}' '#{@query.rx}' "#{folder}")
68
66
  elsif !ag.empty?
69
67
  %(#{ag} -li --nocolor -G '.*.#{ext}' '#{@query.rx}' "#{folder}")
@@ -76,7 +74,7 @@ module Snibbets
76
74
  end
77
75
  else
78
76
  mdfind = TTY::Which.which('mdfind')
79
- if mdfind.empty?
77
+ if mdfind.nil? || mdfind.empty?
80
78
  nil
81
79
  else
82
80
  name_only = Snibbets.options[:name_only] ? '-name ' : ''
@@ -84,9 +82,14 @@ module Snibbets
84
82
  end
85
83
  end
86
84
 
87
- if try == 2 && cmd.nil?
88
- puts "{br}No search method available on this system. Please install ripgrep, silver surfer, ack, or grep.".x
89
- Process.exit 1
85
+ if try == 2
86
+ if Snibbets.options[:name_only]
87
+ puts '{br}No name matches found'.x
88
+ Process.exit 1
89
+ elsif cmd.nil?
90
+ puts '{br}No search method available on this system. Please install ripgrep, silver surfer, ack, or grep.'.x
91
+ Process.exit 1
92
+ end
90
93
  end
91
94
 
92
95
  res = cmd.nil? ? '' : `#{cmd}`.strip
data/snibbets.gemspec CHANGED
@@ -22,7 +22,7 @@ Gem::Specification.new do |spec|
22
22
 
23
23
  spec.require_paths << 'lib'
24
24
  spec.extra_rdoc_files = ['README.md']
25
- spec.rdoc_options << '--title' << 'na' << '--main' << 'README.md' << '--markup' << 'markdown'
25
+ spec.rdoc_options << '--title' << 'snibbets' << '--main' << 'README.md' << '--markup' << 'markdown'
26
26
 
27
27
  spec.bindir = "bin"
28
28
  spec.executables << 'snibbets'
data/src/_README.md CHANGED
@@ -70,7 +70,7 @@ To install Snibbets:
70
70
 
71
71
  gem install snibbets
72
72
 
73
- If you're using the system Ruby, you may need to use `sudo gem install snibbets`.
73
+ If you're using the system Ruby, use `gem install --user-install snibbets` instead.
74
74
 
75
75
  ### Configuration
76
76
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: snibbets
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.33
4
+ version: 2.0.35
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brett Terpstra
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-04-26 00:00:00.000000000 Z
11
+ date: 2023-08-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -311,7 +311,7 @@ metadata:
311
311
  post_install_message:
312
312
  rdoc_options:
313
313
  - "--title"
314
- - na
314
+ - snibbets
315
315
  - "--main"
316
316
  - README.md
317
317
  - "--markup"