snibbets 2.0.33 → 2.0.34
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +12 -0
- data/Gemfile.lock +26 -16
- data/README.md +1 -1
- data/lib/snibbets/string.rb +22 -13
- data/lib/snibbets/version.rb +1 -1
- data/lib/snibbets.rb +9 -6
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4bfb107dedc2d689ec1ed371dcaf1ef7fb240218af43831856acb552789a0ce2
|
4
|
+
data.tar.gz: 482355a0c4a27d707d92633c47adeb2be0db027a37311412cb903f7d47cdb0b6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 40afbc2d33dc562db0e5e21ec7fe40fc10872f279c1bc95b67deb6aac9cff90e663abc0100e49c2a08ea4500e0e2eb4f442bcf34259a54b0b901cf53c883c7ce
|
7
|
+
data.tar.gz: 072cccc7e2c90dc557f4af25b9338a7cec21b00c0545b5155b07f413d6560b7d964008a8919a638b0c0b67089ccd12d568951c314c75c29d896694a3de45e19e
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,15 @@
|
|
1
|
+
### 2.0.34
|
2
|
+
|
3
|
+
2023-06-17 09:17
|
4
|
+
|
5
|
+
#### IMPROVED
|
6
|
+
|
7
|
+
- If a section of a snippet contains no code blocks, output the whole thing
|
8
|
+
|
9
|
+
#### FIXED
|
10
|
+
|
11
|
+
- Correct error if searching name only and no results are returned
|
12
|
+
|
1
13
|
### 2.0.33
|
2
14
|
|
3
15
|
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.
|
4
|
+
snibbets (2.0.34)
|
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
|
-
|
20
|
+
lint_roller (1.0.0)
|
21
|
+
mdless (1.0.33)
|
21
22
|
multi_json (1.15.0)
|
22
|
-
parallel (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.
|
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.
|
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.
|
42
|
+
rspec-core (3.12.2)
|
40
43
|
rspec-support (~> 3.12.0)
|
41
|
-
rspec-expectations (3.12.
|
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.
|
51
|
+
rubocop (1.52.1)
|
49
52
|
json (~> 2.3)
|
50
53
|
parallel (~> 1.10)
|
51
|
-
parser (>= 3.2.
|
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.
|
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.
|
61
|
+
rubocop-ast (1.29.0)
|
59
62
|
parser (>= 3.2.1.0)
|
60
|
-
rubocop-performance (1.
|
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.
|
77
|
+
standard (1.29.0)
|
75
78
|
language_server-protocol (~> 3.17.0.2)
|
76
|
-
|
77
|
-
rubocop
|
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.
|
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
@@ -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.
|
162
|
+
Snibbets v2.0.34
|
163
163
|
|
164
164
|
Usage: snibbets [options] query
|
165
165
|
-a, --all If a file contains multiple snippets, output all of them (no menu)
|
data/lib/snibbets/string.rb
CHANGED
@@ -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+>/
|
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
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
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
|
data/lib/snibbets/version.rb
CHANGED
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
|
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}")
|
@@ -84,9 +82,14 @@ module Snibbets
|
|
84
82
|
end
|
85
83
|
end
|
86
84
|
|
87
|
-
if try == 2
|
88
|
-
|
89
|
-
|
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
|
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.
|
4
|
+
version: 2.0.34
|
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-
|
11
|
+
date: 2023-06-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|