snibbets 2.0.29 → 2.0.31
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.devcontainer/Dockerfile +11 -0
- data/.devcontainer/devcontainer.json +17 -0
- data/.editorconfig +9 -0
- data/.irbrc +2 -0
- data/.rspec +4 -0
- data/.ruby-version +1 -0
- data/CHANGELOG.md +19 -58
- data/Gemfile.lock +1 -1
- data/README.md +4 -1
- data/Snibbets.lbaction/Contents/Info.plist +49 -0
- data/Snibbets.lbaction/Contents/Scripts/default.js +52 -0
- data/Snibbets.lbaction/Contents/Scripts/snibbets.rb +420 -0
- data/bin/snibbets +4 -0
- data/lib/snibbets/array.rb +5 -1
- data/lib/snibbets/config.rb +1 -0
- data/lib/snibbets/highlight.rb +17 -1
- data/lib/snibbets/menu.rb +4 -8
- data/lib/snibbets/os.rb +3 -3
- data/lib/snibbets/string.rb +78 -37
- data/lib/snibbets/todo_spec.rb +11 -0
- data/lib/snibbets/version.rb +1 -1
- data/lib/snibbets.rb +25 -19
- data/scripts/fixreadme.rb +23 -0
- data/snibbets.gemspec +3 -3
- data/{README.md.orig → src/_README.md} +56 -35
- data/yard_templates/default/method_details/setup.rb +3 -0
- metadata +15 -6
- data/Gemfile.lock.orig +0 -107
- data/buildnotes.md +0 -47
- data/snibbets.taskpaper +0 -14
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 67e546441d5515f0c3d14e754843bfc3eed76a5129bff75b810c173d3e0161a8
|
4
|
+
data.tar.gz: 1e98fc1fb3326dd21dfb1ccecbf4c4b44b6a0f26df8053fc998fc80dc57428cd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
data/.irbrc
ADDED
data/.rspec
ADDED
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
3.0.1
|
data/CHANGELOG.md
CHANGED
@@ -1,96 +1,57 @@
|
|
1
|
-
### 2.0.
|
2
|
-
|
3
|
-
2023-04-18 10:45
|
4
|
-
|
5
|
-
#### NEW
|
1
|
+
### 2.0.31
|
6
2
|
|
7
|
-
-
|
3
|
+
2023-04-20 10:20
|
8
4
|
|
9
5
|
#### IMPROVED
|
10
6
|
|
11
|
-
-
|
12
|
-
-
|
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
|
-
-
|
18
|
-
-
|
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.
|
15
|
+
### 2.0.30
|
23
16
|
|
24
|
-
2023-04-
|
17
|
+
2023-04-19 06:44
|
25
18
|
|
26
19
|
#### NEW
|
27
20
|
|
28
|
-
- `--
|
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
|
-
-
|
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
|
-
|
27
|
+
### 2.0.29
|
36
28
|
|
37
|
-
-
|
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
|
-
|
31
|
+
#### IMPROVED
|
42
32
|
|
43
|
-
|
33
|
+
- Better removal of extra leading/trailing newlines
|
44
34
|
|
45
|
-
####
|
35
|
+
#### FIXED
|
46
36
|
|
47
|
-
-
|
37
|
+
- Selecting 'All snippets' could return blank results in some cases
|
48
38
|
|
49
|
-
|
39
|
+
### 2.0.28
|
50
40
|
|
51
|
-
-
|
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
|
-
-
|
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
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.
|
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
|
+
}
|