snibbets 2.0.29 → 2.0.31

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: c514df1f69038d43d34563cc23735ccb8c3912f407a533d90aeacc5e924c81a5
4
- data.tar.gz: bce3c77b30ee7369040fcc3af38801ad0b21a53c5f5ce7d991c4f95ec14a249e
3
+ metadata.gz: 67e546441d5515f0c3d14e754843bfc3eed76a5129bff75b810c173d3e0161a8
4
+ data.tar.gz: 1e98fc1fb3326dd21dfb1ccecbf4c4b44b6a0f26df8053fc998fc80dc57428cd
5
5
  SHA512:
6
- metadata.gz: a41ac5237f863911b9950670073fb6922ebf341e1ad06650e475de18f724028edcb1589b5ffcd50c47ef8f144161ecde58c50761967e6f7a60b66586ac1c2a15
7
- data.tar.gz: a8d3281abaa277a56e85d4e5275a68cf825fe3bb13eb5714bc43d186bd1a5ec681cf44fdea35290539fb1005c15d8dde308fe44a47295e3f46a5e4e4541f03be
6
+ metadata.gz: 32936396eb50e8b9186f15f12333c7603134fe5861d80c070bb0e96ef4e1d8b248103d46b4cba3cd97d8036e9bd0c82b4dc707911434b9fd7ea97282114e77ca
7
+ data.tar.gz: 0d22c987dc50165333bfd5d016f3c1d67bd64d842a968c35ec53a5cd2c5e94e95536fee25e54d3c32ba710a6189a84c573d49587baeb34f610f7f3ba6c552b73
@@ -0,0 +1,11 @@
1
+ ARG VARIANT="3"
2
+
3
+ FROM mcr.microsoft.com/vscode/devcontainers/ruby:${VARIANT}
4
+
5
+ USER vscode
6
+ WORKDIR /home/vscode
7
+
8
+ RUN mkdir -p .config/git \
9
+ && echo ".vscode/*" >> .config/git/ignore \
10
+ && echo "*.code-workspace" >> .config/git/ignore \
11
+ && echo ".history/" >> .config/git/ignore
@@ -0,0 +1,17 @@
1
+ {
2
+ "name": "Ruby",
3
+ "build": {
4
+ "dockerfile": "Dockerfile",
5
+ "args": {
6
+ "VARIANT": "3"
7
+ }
8
+ },
9
+ "extensions": [
10
+ "rebornix.Ruby",
11
+ "ms-vsliveshare.vsliveshare",
12
+ "EditorConfig.EditorConfig",
13
+ "esbenp.prettier-vscode"
14
+ ],
15
+ "postCreateCommand": "bundle install",
16
+ "remoteUser": "vscode"
17
+ }
data/.editorconfig ADDED
@@ -0,0 +1,9 @@
1
+ root = true
2
+
3
+ [*]
4
+ charset = utf-8
5
+ end_of_line = lf
6
+ insert_final_newline = true
7
+ trim_trailing_whitespace = true
8
+ indent_style = space
9
+ indent_size = 2
data/.irbrc ADDED
@@ -0,0 +1,2 @@
1
+ require_relative 'lib/snibbets'
2
+ include Snibbets
data/.rspec ADDED
@@ -0,0 +1,4 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
4
+ --pattern "{spec,lib}/**/*_spec.rb"
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ 3.0.1
data/CHANGELOG.md CHANGED
@@ -1,96 +1,57 @@
1
- ### 2.0.29
2
-
3
- 2023-04-18 10:45
4
-
5
- #### NEW
1
+ ### 2.0.31
6
2
 
7
- - `--nvultra` will open the selected snippet in nvUltra
3
+ 2023-04-20 10:20
8
4
 
9
5
  #### IMPROVED
10
6
 
11
- - Use Readline for entering info with `--paste`, allows for better editing experience
12
- - Allow `--edit` with `--paste` to open the new snippet in your editor immediately
13
- - Better removal of extra leading/trailing newlines
7
+ - Syntax highlight blocks individually, so multiple languages can exist within one snippet
8
+ - If outputting notes, wrap code in backticks to differentiate
14
9
 
15
10
  #### FIXED
16
11
 
17
- - Code indentation with `--paste`
18
- - Nil error when highlighting without extension
19
- - When detecting indented code blocks, require a blank line (or start of file) before them, to avoid picking up lines within indented lists
20
- - Selecting 'All snippets' could return blank results in some cases
12
+ - Handle cases where snippet contains `\k<name>` and breaks regex replacement even with Regexp.escape
13
+ - Remove fences from single snippet when not syntax highlighting
21
14
 
22
- ### 2.0.28
15
+ ### 2.0.30
23
16
 
24
- 2023-04-18 09:18
17
+ 2023-04-19 06:44
25
18
 
26
19
  #### NEW
27
20
 
28
- - `--nvultra` will open the selected snippet in nvUltra
21
+ - Added `--notes` option and accompanying `all_notes` config option to allow display of all notes instead of just code blocks in each snippet
29
22
 
30
23
  #### IMPROVED
31
24
 
32
- - Use Readline for entering info with `--paste`, allows for better editing experience
33
- - Allow `--edit` with `--paste` to open the new snippet in your editor immediately
25
+ - Previously if multiple snippets were output, titles of snippets would go to STDERR so they weren't copied. Now they go to STDOUT as well.
34
26
 
35
- #### FIXED
27
+ ### 2.0.29
36
28
 
37
- - Code indentation with `--paste`
38
- - Nil error when highlighting without extension
39
- - When detecting indented code blocks, require a blank line (or start of file) before them, to avoid picking up lines within indented lists
29
+ 2023-04-18 10:45
40
30
 
41
- ### 2.0.27
31
+ #### IMPROVED
42
32
 
43
- 2023-04-17 15:54
33
+ - Better removal of extra leading/trailing newlines
44
34
 
45
- #### NEW
35
+ #### FIXED
46
36
 
47
- - `--nvultra` will open the selected snippet in nvUltra
37
+ - Selecting 'All snippets' could return blank results in some cases
48
38
 
49
- #### IMPROVED
39
+ ### 2.0.28
50
40
 
51
- - Use Readline for entering info with `--paste`, allows for better editing experience
52
- - Allow `--edit` with `--paste` to open the new snippet in your editor immediately
41
+ 2023-04-18 09:18
53
42
 
54
43
  #### FIXED
55
44
 
56
- - Code indentation with `--paste`
57
- - Nil error when highlighting without extension
45
+ - When detecting indented code blocks, require a blank line (or start of file) before them, to avoid picking up lines within indented lists
58
46
 
59
47
  ### 2.0.26
60
48
 
61
49
  2023-04-16 11:18
62
50
 
63
- #### NEW
64
-
65
- - `--nvultra` will open the selected snippet in nvUltra
66
-
67
- #### IMPROVED
68
-
69
- - Use Readline for entering info with `--paste`, allows for better editing experience
70
- - Allow `--edit` with `--paste` to open the new snippet in your editor immediately
71
-
72
51
  #### FIXED
73
52
 
74
- - Code indentation with `--paste`
75
53
  - Nil error when highlighting without extension
76
54
 
77
- ### 2.0.25
78
-
79
- 2023-04-16 11:09
80
-
81
- #### NEW
82
-
83
- - `--nvultra` will open the selected snippet in nvUltra
84
-
85
- #### IMPROVED
86
-
87
- - Use Readline for entering info with `--paste`, allows for better editing experience
88
- - Allow `--edit` with `--paste` to open the new snippet in your editor immediately
89
-
90
- #### FIXED
91
-
92
- - Code indentation with `--paste`
93
-
94
55
  ### 2.0.24
95
56
 
96
57
  2023-04-16 10:49
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- snibbets (2.0.29)
4
+ snibbets (2.0.31)
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)
data/README.md CHANGED
@@ -102,6 +102,8 @@ Set the `source` key to the folder where you keep your Markdown snippets. Option
102
102
 
103
103
  The `all` setting determines how Snibbets handles files containing multiple snippets. If `all` is true, then it will always display every snippet in the selected file. If false, it will offer a menu and let you choose which snippet to display. You can use `--all` on the command line to just enable this once.
104
104
 
105
+ By default, Snibbets displays only the code from each snippet (and optionally block quotes, see below). If you set `all_notes` to true, then the full content of each snippet containing a code block will be returned, allowing you to see additional notes on the command line. This can be toggled at runtime with `--notes` or `--no-notes`.
106
+
105
107
  The `copy` setting determines whether the output is copied to the clipboard in addition to being displayed on STDOUT. This is the equivalent of running `snibbets QUERY | pbcopy` (macOS) or `snibbets QUERY | xclip` (Linux). This can be enabled for just one run with `--copy` on the command line. Setting it to true in the config will copy to the clipboard every time a snippet is displayed. On Mac this will work automatically, on Windows/Linux you may need to [install `xclip` or `xsel`][xclip].
106
108
 
107
109
  [xclip]: https://ostechnix.com/access-clipboard-contents-using-xclip-and-xsel-in-linux/
@@ -157,13 +159,14 @@ Snibbet's implementation of Skylighting has limited but better-looking themes, a
157
159
  ### Usage
158
160
 
159
161
  ```
160
- Snibbets v2.0.29
162
+ Snibbets v2.0.31
161
163
 
162
164
  Usage: snibbets [options] query
163
165
  -a, --all If a file contains multiple snippets, output all of them (no menu)
164
166
  -c, --[no-]copy Copy the output to the clibpoard (also displays on STDOUT)
165
167
  -e, --edit Open the selected snippet in your configured editor
166
168
  -n, --[no-]name-only Only search file names, not content
169
+ --[no-]notes Display the full content of the snippet
167
170
  -o, --output FORMAT Output format (json|launchbar|*raw)
168
171
  -p, --paste, --new Interactively create a new snippet from clipboard contents (Mac only)
169
172
  -q, --quiet Skip menus and display first match
@@ -0,0 +1,49 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3
+ <plist version="1.0">
4
+ <dict>
5
+ <key>CFBundleIdentifier</key>
6
+ <string>com.brettterpstra.LaunchBar.action.Snibbets</string>
7
+ <key>CFBundleName</key>
8
+ <string>Snibbets</string>
9
+ <key>LBAbbreviation</key>
10
+ <string>snib</string>
11
+ <key>LBDebugLogEnabled</key>
12
+ <true/>
13
+ <key>LBDescription</key>
14
+ <dict>
15
+ <key>LBAuthor</key>
16
+ <string>Brett Terpstra</string>
17
+ <key>LBEmail</key>
18
+ <string>me@brettterpstra.com</string>
19
+ <key>LBSummary</key>
20
+ <string>Search a folder of plain text code snippets and paste results</string>
21
+ <key>LBTwitter</key>
22
+ <string>@ttscoff</string>
23
+ <key>LBWebsiteURL</key>
24
+ <string></string>
25
+ </dict>
26
+ <key>LBScripts</key>
27
+ <dict>
28
+ <key>LBDefaultScript</key>
29
+ <dict>
30
+ <key>LBAcceptedArgumentTypes</key>
31
+ <array>
32
+ <string>string</string>
33
+ </array>
34
+ <key>LBKeepWindowActive</key>
35
+ <true/>
36
+ <key>LBResultType</key>
37
+ <string>unknown</string>
38
+ <key>LBReturnsResult</key>
39
+ <true/>
40
+ <key>LBScriptName</key>
41
+ <string>default.js</string>
42
+ </dict>
43
+ </dict>
44
+ <key>LBTextInputTitle</key>
45
+ <string>Search snippets</string>
46
+ <key>NSHumanReadableCopyright</key>
47
+ <string>Brett Terpstra 2019</string>
48
+ </dict>
49
+ </plist>
@@ -0,0 +1,52 @@
1
+ // LaunchBar Action Script
2
+
3
+ function run() {
4
+ settingsItem = {
5
+ 'title' : 'Choose Snippets Folder',
6
+ 'action' : 'setFolder',
7
+ 'label' : 'Choose',
8
+ 'subtitle' : ''
9
+ }
10
+ if (Action.preferences.snippetsFolder) {
11
+ settingsItem.subtitle = Action.preferences.snippetsFolder;
12
+ }
13
+ return [settingsItem];
14
+ }
15
+
16
+ function runWithString(string) {
17
+ var folder = Action.preferences.snippetsFolder;
18
+ var result = LaunchBar.execute('/usr/bin/env', 'ruby' , 'snibbets.rb', '-o', 'launchbar', '-s', encodeURI(folder), encodeURI(string));
19
+ if (result)
20
+ return JSON.parse(result);
21
+ else
22
+ return {'title': 'No matches'}
23
+ }
24
+
25
+ function copyIt(item) {
26
+ LaunchBar.setClipboardString(item);
27
+ LaunchBar.openCommandURL('hide'); // for some reason LaunchBar.hide() doesn't execute, but this does. Sometimes.
28
+ LaunchBar.hide();
29
+ }
30
+
31
+ function pasteIt(item) {
32
+ LaunchBar.paste(item.code);
33
+ LaunchBar.openCommandURL('hide');
34
+ LaunchBar.hide();
35
+ }
36
+
37
+ function setFolder(item) {
38
+ LaunchBar.displayInLargeType({
39
+ title: 'Choosing folder'
40
+ });
41
+ var defaultFolder = LaunchBar.homeDirectory;
42
+ if (Action.preferences.snippetsFolder) {
43
+ defaultFolder = Action.preferences.snippetsFolder;
44
+ }
45
+ var k = LaunchBar.executeAppleScript(
46
+ 'set _default to POSIX file "' + defaultFolder + '" as alias \n' +
47
+ 'set _folder to choose folder with prompt "Select Snippets Folder" default location _default \n' +
48
+ ' return POSIX path of _folder');
49
+ if (k && k.length > 0) {
50
+ Action.preferences.snippetsFolder = k.trim();
51
+ }
52
+ }