snibbets 2.0.21 → 2.0.22
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/CHANGELOG.md +135 -0
- data/Gemfile.lock +11 -1
- data/README.md +2 -1
- data/bin/snibbets +20 -0
- data/lib/snibbets/version.rb +1 -1
- data/lib/snibbets.rb +14 -8
- data/snibbets.gemspec +2 -0
- metadata +41 -2
- data/CHANGELOG.md.orig +0 -168
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 57f007cba021726dc009fc7817e47a0bab227238858bcd988db39084c6d38533
|
4
|
+
data.tar.gz: '017086d98c644e5fe3f692ccd8ccd15f06a754d0ff20385daf6e2d2f5b77cc33'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6cf09bb6c7c548c849e9b9f3ecef02f2960bc4c0ad1df68cbca814ad05d95c011723fced0043083280b87d5c8e473763894e66ec3cc08d69cfa141b804cb3a4a
|
7
|
+
data.tar.gz: e1f646b3216106a95c796f7838515026dabda0d103f759667d9855e57847420740e682128e1c1b873b1f265debfa5449b9af024ca025d339f5378190bbc3b66f
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,138 @@
|
|
1
|
+
### 2.0.22
|
2
|
+
|
3
|
+
2023-04-16 09:33
|
4
|
+
|
5
|
+
#### IMPROVED
|
6
|
+
|
7
|
+
- Use Readline for entering info with `--paste`, allows for better editing experience
|
8
|
+
|
9
|
+
#### FIXED
|
10
|
+
|
11
|
+
- Code indentation with `--paste`
|
12
|
+
|
13
|
+
### 2.0.21
|
14
|
+
|
15
|
+
2023-04-16 09:04
|
16
|
+
|
17
|
+
#### IMPROVED
|
18
|
+
|
19
|
+
- Use leading and trailing hashes to make snippet titles more obvious when outputting All Snippets
|
20
|
+
|
21
|
+
### 2.0.20
|
22
|
+
|
23
|
+
2023-04-16 08:31
|
24
|
+
|
25
|
+
#### FIXED
|
26
|
+
|
27
|
+
- Fail to include skylighting themes in gem bundle
|
28
|
+
- Failure to recognize fenced code blocks with language specifiers containing hyphens
|
29
|
+
|
30
|
+
### 2.0.19
|
31
|
+
|
32
|
+
2023-04-16 08:05
|
33
|
+
|
34
|
+
#### FIXED
|
35
|
+
|
36
|
+
- A fenced code block following a line containing only 4+ spaces or tabs would get parsed as an indented code block
|
37
|
+
- Last fenced code block in a snippet might not be recognized
|
38
|
+
|
39
|
+
### 2.0.18
|
40
|
+
|
41
|
+
2023-04-16 06:57
|
42
|
+
|
43
|
+
#### FIXED
|
44
|
+
|
45
|
+
- If an invalid language (without a lexer) is supplied when using `--paste`, just use the input as the extension and tag
|
46
|
+
|
47
|
+
### 2.0.17
|
48
|
+
|
49
|
+
2023-04-16 06:31
|
50
|
+
|
51
|
+
#### NEW
|
52
|
+
|
53
|
+
- Languages specified in the opening fence of a code block are passed to the syntax highlighter (only affects Skylighting)
|
54
|
+
|
55
|
+
#### IMPROVED
|
56
|
+
|
57
|
+
- Add all available themes for Skylighting
|
58
|
+
- Allow a custom theme path to be provided for Skylighting by including a path in `highlight_theme` config
|
59
|
+
- Handle syntax highlighter errors, returning plain code if command fails
|
60
|
+
|
61
|
+
#### FIXED
|
62
|
+
|
63
|
+
- Disable syntax highlighting when command is being piped or redirected
|
64
|
+
- Don't syntax highlight clipboard code when using `--copy`
|
65
|
+
|
66
|
+
### 2.0.16
|
67
|
+
|
68
|
+
2023-04-15 22:15
|
69
|
+
|
70
|
+
#### FIXED
|
71
|
+
|
72
|
+
- Remove debugging output
|
73
|
+
|
74
|
+
### 2.0.15
|
75
|
+
|
76
|
+
2023-04-15 22:11
|
77
|
+
|
78
|
+
#### NEW
|
79
|
+
|
80
|
+
- Additional themes for skylighting: nord, monokai, solarized-light/dark
|
81
|
+
|
82
|
+
#### FIXED
|
83
|
+
|
84
|
+
- Bad path to highlighter themes for skylighting
|
85
|
+
|
86
|
+
### 2.0.14
|
87
|
+
|
88
|
+
2023-04-15 21:21
|
89
|
+
|
90
|
+
#### IMPROVED
|
91
|
+
|
92
|
+
- Better default themes for highlighters
|
93
|
+
|
94
|
+
#### FIXED
|
95
|
+
|
96
|
+
- Error with lexers_db when using higlighting
|
97
|
+
|
98
|
+
### 2.0.13
|
99
|
+
|
100
|
+
2023-04-15 19:57
|
101
|
+
|
102
|
+
#### NEW
|
103
|
+
|
104
|
+
- Option to include blockquotes (>) in output
|
105
|
+
|
106
|
+
### 2.0.12
|
107
|
+
|
108
|
+
2023-04-15 19:28
|
109
|
+
|
110
|
+
#### FIXED
|
111
|
+
|
112
|
+
- Lowered minimum ruby version to allow Ruby 2.6
|
113
|
+
- Failure to recognize snippet if title is on first line of file
|
114
|
+
- Errantly discarding first snippet in file with multiple snippets
|
115
|
+
|
116
|
+
### 2.0.11
|
117
|
+
|
118
|
+
2023-04-15 19:06
|
119
|
+
|
120
|
+
#### FIXED
|
121
|
+
|
122
|
+
- Overactive stripping of newlines within code blocks
|
123
|
+
- Syntax definition determination when adding new snippets
|
124
|
+
|
125
|
+
### 2.0.10
|
126
|
+
|
127
|
+
2023-04-15 16:28
|
128
|
+
|
129
|
+
#### FIXED
|
130
|
+
|
131
|
+
- Update dependencies for security
|
132
|
+
- Incorporate fixes from @robjwells addressing #3 and #4
|
133
|
+
- Incorporate fixes from @robjwells addressing #3 and #4
|
134
|
+
- Best menu CLI determination missing modules
|
135
|
+
|
1
136
|
### 2.0.9
|
2
137
|
|
3
138
|
2023-04-15 15:44
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,9 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
snibbets (2.0.
|
4
|
+
snibbets (2.0.22)
|
5
|
+
mdless (~> 1.0, >= 1.0.32)
|
6
|
+
tty-reader (~> 0.9, >= 0.9.0)
|
5
7
|
tty-which (~> 0.5, >= 0.5.0)
|
6
8
|
|
7
9
|
GEM
|
@@ -15,6 +17,7 @@ GEM
|
|
15
17
|
gem-release (2.2.2)
|
16
18
|
json (2.6.3)
|
17
19
|
language_server-protocol (3.17.0.3)
|
20
|
+
mdless (1.0.32)
|
18
21
|
multi_json (1.15.0)
|
19
22
|
parallel (1.22.1)
|
20
23
|
parse_gemspec (1.0.0)
|
@@ -75,8 +78,15 @@ GEM
|
|
75
78
|
terminal-table (3.0.2)
|
76
79
|
unicode-display_width (>= 1.1.1, < 3)
|
77
80
|
thor (1.2.1)
|
81
|
+
tty-cursor (0.7.1)
|
82
|
+
tty-reader (0.9.0)
|
83
|
+
tty-cursor (~> 0.7)
|
84
|
+
tty-screen (~> 0.8)
|
85
|
+
wisper (~> 2.0)
|
86
|
+
tty-screen (0.8.1)
|
78
87
|
tty-which (0.5.0)
|
79
88
|
unicode-display_width (2.4.2)
|
89
|
+
wisper (2.0.1)
|
80
90
|
yard (0.9.34)
|
81
91
|
|
82
92
|
PLATFORMS
|
data/README.md
CHANGED
@@ -155,7 +155,7 @@ Snibbet's implementation of Skylighting has limited but better-looking themes, a
|
|
155
155
|
### Usage
|
156
156
|
|
157
157
|
```
|
158
|
-
Snibbets v2.0.
|
158
|
+
Snibbets v2.0.22
|
159
159
|
|
160
160
|
Usage: snibbets [options] query
|
161
161
|
-a, --all If a file contains multiple snippets, output all of them (no menu)
|
@@ -172,6 +172,7 @@ Usage: snibbets [options] query
|
|
172
172
|
--save Save the current command line options to the YAML configuration
|
173
173
|
-h, --help Display this screen
|
174
174
|
-v, --version Display version information
|
175
|
+
--changes Display the changelog (release notes)
|
175
176
|
```
|
176
177
|
|
177
178
|
If your Snippets folder is set in the config, simply running `snibbets [search query]` will perform the search and output the code blocks, presenting a menu if more than one match is found or the target file contains more than one snippet. Selected contents are output raw to STDOUT.
|
data/bin/snibbets
CHANGED
@@ -8,6 +8,21 @@ module Snibbets
|
|
8
8
|
class << self
|
9
9
|
attr_reader :query
|
10
10
|
|
11
|
+
def display_changelog
|
12
|
+
changelog = File.expand_path(File.join(__dir__, '..', 'CHANGELOG.md'))
|
13
|
+
pagers = [
|
14
|
+
'mdless',
|
15
|
+
'mdcat -p',
|
16
|
+
'bat',
|
17
|
+
ENV['PAGER'],
|
18
|
+
'less -FXr',
|
19
|
+
ENV['GIT_PAGER'],
|
20
|
+
'more -r'
|
21
|
+
]
|
22
|
+
pager = pagers.find { |cmd| TTY::Which.exist?(cmd.split.first) }
|
23
|
+
system %(#{TTY::Which.which(pager)} "#{changelog}")
|
24
|
+
end
|
25
|
+
|
11
26
|
def run
|
12
27
|
options = Snibbets.options
|
13
28
|
arguments = Snibbets.arguments
|
@@ -81,6 +96,11 @@ module Snibbets
|
|
81
96
|
puts "Snibbets v#{VERSION}"
|
82
97
|
Process.exit 0
|
83
98
|
end
|
99
|
+
|
100
|
+
opts.on('--changes', 'Display the changelog (release notes)') do
|
101
|
+
display_changelog
|
102
|
+
Process.exit 0
|
103
|
+
end
|
84
104
|
end
|
85
105
|
|
86
106
|
optparse.parse!
|
data/lib/snibbets/version.rb
CHANGED
data/lib/snibbets.rb
CHANGED
@@ -8,6 +8,7 @@ require 'shellwords'
|
|
8
8
|
require 'yaml'
|
9
9
|
require 'fileutils'
|
10
10
|
require 'tty-which'
|
11
|
+
require 'tty-reader'
|
11
12
|
require 'open3'
|
12
13
|
require_relative 'snibbets/version'
|
13
14
|
require_relative 'snibbets/config'
|
@@ -143,33 +144,38 @@ module Snibbets
|
|
143
144
|
end
|
144
145
|
|
145
146
|
def new_snippet_from_clipboard
|
147
|
+
return false unless $stdin.isatty
|
148
|
+
|
146
149
|
trap('SIGINT') do
|
147
150
|
Howzit.console.info "\nCancelled"
|
148
151
|
exit!
|
149
152
|
end
|
150
153
|
|
151
154
|
pb = OS.paste.outdent
|
155
|
+
reader = TTY::Reader.new
|
152
156
|
|
153
|
-
printf 'What does this snippet do? '
|
154
|
-
input =
|
157
|
+
# printf 'What does this snippet do? '
|
158
|
+
input = reader.read_line('What does this snippet do? ').strip
|
159
|
+
# input = $stdin.gets.chomp
|
155
160
|
title = input unless input.empty?
|
156
161
|
|
157
|
-
printf 'What language(s) does it use (separate with spaces, full names or file extensions will work)? '
|
158
|
-
input =
|
162
|
+
# printf 'What language(s) does it use (separate with spaces, full names or file extensions will work)? '
|
163
|
+
input = reader.read_line('What language(s) does it use (separate with spaces, full names or file extensions will work)? ').strip
|
164
|
+
# input = $stdin.gets.chomp
|
159
165
|
langs = input.split(/ +/).map(&:strip) unless input.empty?
|
160
166
|
exts = langs.map { |lang| Lexers.lang_to_ext(lang) }.delete_if(&:nil?)
|
161
167
|
tags = langs.map { |lang| Lexers.ext_to_lang(lang) }.concat(langs).delete_if(&:nil?).sort.uniq
|
162
168
|
|
163
169
|
exts = langs if exts.empty?
|
164
170
|
|
165
|
-
filename = "#{title}
|
171
|
+
filename = "#{title}#{exts.map { |x| ".#{x}"}.join('')}.#{Snibbets.options[:extension]}"
|
166
172
|
|
167
173
|
File.open(File.join(File.expand_path(Snibbets.options[:source]), filename), 'w') do |f|
|
168
174
|
f.puts "tags: #{tags.join(', ')}
|
169
175
|
|
170
|
-
|
171
|
-
|
172
|
-
|
176
|
+
```
|
177
|
+
#{pb}
|
178
|
+
```"
|
173
179
|
end
|
174
180
|
|
175
181
|
puts "New snippet written to #{filename}."
|
data/snibbets.gemspec
CHANGED
@@ -43,4 +43,6 @@ Gem::Specification.new do |spec|
|
|
43
43
|
spec.add_development_dependency "simplecov-console", "~> 0.9"
|
44
44
|
spec.add_development_dependency "standard", "~> 1.3"
|
45
45
|
spec.add_runtime_dependency 'tty-which', '~> 0.5', '>= 0.5.0'
|
46
|
+
spec.add_runtime_dependency('tty-reader', '~> 0.9', '>= 0.9.0')
|
47
|
+
spec.add_runtime_dependency('mdless', '~> 1.0', '>= 1.0.32')
|
46
48
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
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.22
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brett Terpstra
|
@@ -190,6 +190,46 @@ dependencies:
|
|
190
190
|
- - ">="
|
191
191
|
- !ruby/object:Gem::Version
|
192
192
|
version: 0.5.0
|
193
|
+
- !ruby/object:Gem::Dependency
|
194
|
+
name: tty-reader
|
195
|
+
requirement: !ruby/object:Gem::Requirement
|
196
|
+
requirements:
|
197
|
+
- - "~>"
|
198
|
+
- !ruby/object:Gem::Version
|
199
|
+
version: '0.9'
|
200
|
+
- - ">="
|
201
|
+
- !ruby/object:Gem::Version
|
202
|
+
version: 0.9.0
|
203
|
+
type: :runtime
|
204
|
+
prerelease: false
|
205
|
+
version_requirements: !ruby/object:Gem::Requirement
|
206
|
+
requirements:
|
207
|
+
- - "~>"
|
208
|
+
- !ruby/object:Gem::Version
|
209
|
+
version: '0.9'
|
210
|
+
- - ">="
|
211
|
+
- !ruby/object:Gem::Version
|
212
|
+
version: 0.9.0
|
213
|
+
- !ruby/object:Gem::Dependency
|
214
|
+
name: mdless
|
215
|
+
requirement: !ruby/object:Gem::Requirement
|
216
|
+
requirements:
|
217
|
+
- - "~>"
|
218
|
+
- !ruby/object:Gem::Version
|
219
|
+
version: '1.0'
|
220
|
+
- - ">="
|
221
|
+
- !ruby/object:Gem::Version
|
222
|
+
version: 1.0.32
|
223
|
+
type: :runtime
|
224
|
+
prerelease: false
|
225
|
+
version_requirements: !ruby/object:Gem::Requirement
|
226
|
+
requirements:
|
227
|
+
- - "~>"
|
228
|
+
- !ruby/object:Gem::Version
|
229
|
+
version: '1.0'
|
230
|
+
- - ">="
|
231
|
+
- !ruby/object:Gem::Version
|
232
|
+
version: 1.0.32
|
193
233
|
description: A plain text code snippet manager
|
194
234
|
email: me@brettterpstra.com
|
195
235
|
executables:
|
@@ -199,7 +239,6 @@ extra_rdoc_files:
|
|
199
239
|
- README.md
|
200
240
|
files:
|
201
241
|
- CHANGELOG.md
|
202
|
-
- CHANGELOG.md.orig
|
203
242
|
- Gemfile
|
204
243
|
- Gemfile.lock
|
205
244
|
- Gemfile.lock.orig
|
data/CHANGELOG.md.orig
DELETED
@@ -1,168 +0,0 @@
|
|
1
|
-
### 2.0.21
|
2
|
-
|
3
|
-
2023-04-16 09:04
|
4
|
-
|
5
|
-
#### IMPROVED
|
6
|
-
|
7
|
-
- Use leading and trailing hashes to make snippet titles more obvious when outputting All Snippets
|
8
|
-
|
9
|
-
### 2.0.20
|
10
|
-
|
11
|
-
2023-04-16 08:31
|
12
|
-
|
13
|
-
#### FIXED
|
14
|
-
|
15
|
-
- Fail to include skylighting themes in gem bundle
|
16
|
-
- Failure to recognize fenced code blocks with language specifiers containing hyphens
|
17
|
-
|
18
|
-
### 2.0.19
|
19
|
-
|
20
|
-
2023-04-16 08:05
|
21
|
-
|
22
|
-
#### FIXED
|
23
|
-
|
24
|
-
- A fenced code block following a line containing only 4+ spaces or tabs would get parsed as an indented code block
|
25
|
-
- Last fenced code block in a snippet might not be recognized
|
26
|
-
|
27
|
-
### 2.0.18
|
28
|
-
|
29
|
-
2023-04-16 06:57
|
30
|
-
|
31
|
-
#### FIXED
|
32
|
-
|
33
|
-
- If an invalid language (without a lexer) is supplied when using `--paste`, just use the input as the extension and tag
|
34
|
-
|
35
|
-
### 2.0.17
|
36
|
-
|
37
|
-
2023-04-16 06:31
|
38
|
-
|
39
|
-
#### NEW
|
40
|
-
|
41
|
-
- Languages specified in the opening fence of a code block are passed to the syntax highlighter (only affects Skylighting)
|
42
|
-
|
43
|
-
#### IMPROVED
|
44
|
-
|
45
|
-
- Add all available themes for Skylighting
|
46
|
-
- Allow a custom theme path to be provided for Skylighting by including a path in `highlight_theme` config
|
47
|
-
- Handle syntax highlighter errors, returning plain code if command fails
|
48
|
-
|
49
|
-
#### FIXED
|
50
|
-
|
51
|
-
- Disable syntax highlighting when command is being piped or redirected
|
52
|
-
- Don't syntax highlight clipboard code when using `--copy`
|
53
|
-
|
54
|
-
### 2.0.16
|
55
|
-
|
56
|
-
2023-04-15 22:15
|
57
|
-
|
58
|
-
#### FIXED
|
59
|
-
|
60
|
-
- Remove debugging output
|
61
|
-
|
62
|
-
### 2.0.15
|
63
|
-
|
64
|
-
2023-04-15 22:11
|
65
|
-
|
66
|
-
#### NEW
|
67
|
-
|
68
|
-
- Additional themes for skylighting: nord, monokai, solarized-light/dark
|
69
|
-
|
70
|
-
#### FIXED
|
71
|
-
|
72
|
-
- Bad path to highlighter themes for skylighting
|
73
|
-
|
74
|
-
### 2.0.14
|
75
|
-
|
76
|
-
2023-04-15 21:21
|
77
|
-
|
78
|
-
#### IMPROVED
|
79
|
-
|
80
|
-
- Better default themes for highlighters
|
81
|
-
|
82
|
-
#### FIXED
|
83
|
-
|
84
|
-
- Error with lexers_db when using higlighting
|
85
|
-
|
86
|
-
### 2.0.13
|
87
|
-
|
88
|
-
2023-04-15 19:57
|
89
|
-
|
90
|
-
#### NEW
|
91
|
-
|
92
|
-
- Option to include blockquotes (>) in output
|
93
|
-
|
94
|
-
### 2.0.12
|
95
|
-
|
96
|
-
2023-04-15 19:28
|
97
|
-
|
98
|
-
#### FIXED
|
99
|
-
|
100
|
-
- Lowered minimum ruby version to allow Ruby 2.6
|
101
|
-
- Failure to recognize snippet if title is on first line of file
|
102
|
-
- Errantly discarding first snippet in file with multiple snippets
|
103
|
-
|
104
|
-
### 2.0.11
|
105
|
-
|
106
|
-
2023-04-15 19:06
|
107
|
-
|
108
|
-
#### FIXED
|
109
|
-
|
110
|
-
- Overactive stripping of newlines within code blocks
|
111
|
-
- Syntax definition determination when adding new snippets
|
112
|
-
|
113
|
-
### 2.0.10
|
114
|
-
|
115
|
-
2023-04-15 16:28
|
116
|
-
|
117
|
-
#### FIXED
|
118
|
-
|
119
|
-
- Update dependencies for security
|
120
|
-
- Incorporate fixes from @robjwells addressing #3 and #4
|
121
|
-
- Incorporate fixes from @robjwells addressing #3 and #4
|
122
|
-
- Best menu CLI determination missing modules
|
123
|
-
|
124
|
-
<<<<<<< HEAD
|
125
|
-
### 2.0.7
|
126
|
-
|
127
|
-
2023-04-15 12:02
|
128
|
-
=======
|
129
|
-
### 2.0.9
|
130
|
-
|
131
|
-
2023-04-15 15:44
|
132
|
-
|
133
|
-
#### IMPROVED
|
134
|
-
|
135
|
-
- Allow setting `menus` config key to force Snibbets to use fzf, gum, or console menus
|
136
|
-
- Allow setting `menus` config key to force Snibbets to use fzf, gum, or console menus
|
137
|
-
|
138
|
-
#### FIXED
|
139
|
-
|
140
|
-
- If a header section contains no code blocks, don't display it in menu
|
141
|
-
- Remove leading and trailing newlines without affecting indentation
|
142
|
-
|
143
|
-
### 2.0.8
|
144
|
-
|
145
|
-
2023-04-15 15:41
|
146
|
-
|
147
|
-
#### IMPROVED
|
148
|
-
|
149
|
-
- Allow setting `menus` config key to force Snibbets to use fzf, gum, or console menus
|
150
|
-
- Allow setting `menus` config key to force Snibbets to use fzf, gum, or console menus
|
151
|
-
|
152
|
-
#### FIXED
|
153
|
-
|
154
|
-
- If a header section contains no code blocks, don't display it in menu
|
155
|
-
- Remove leading and trailing newlines without affecting indentation
|
156
|
-
>>>>>>> release/2.0.9
|
157
|
-
|
158
|
-
### 2.0.6
|
159
|
-
|
160
|
-
2023-04-15 11:55
|
161
|
-
|
162
|
-
#### IMPROVED
|
163
|
-
|
164
|
-
- Refactor script as modules and classes
|
165
|
-
|
166
|
-
## 2.0.2
|
167
|
-
|
168
|
-
Initial release as a gem
|