snibbets 2.0.12 → 2.0.13

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: 730cb0a9e548f9d590fb8eb8088bf279e5848dc7822fd2f7022e0c2c472f31e9
4
- data.tar.gz: 544dbd0f8de24623ad0c4c4ef56be8ba77bb7b55a2aa6355c39ceaa51fae9519
3
+ metadata.gz: 72d22da7e8723b49ee57a4b244c36dfc798f3f73eee8b936c0538eb09028f302
4
+ data.tar.gz: e0fa3c991a45448cdb6119583e34f631cc99e8028cb890c86fcc2a0a2bb8b2b5
5
5
  SHA512:
6
- metadata.gz: 25175a8f43be5bf5793e1953d570314f558baaa2b2bdb6e7045f2f4e7ae4e081c86033b87f91d567c6f10c9a4ae9ea5e9ceb45117e4a6848a184a35d2e0bc4e9
7
- data.tar.gz: fb643c8813e3fc6183a484395bc1326d44ebc994615d0b07f9cefc06b5099f40fdbc67b289e6108e54970c751e7f1fda603c3c228607862162d628f11bdd0c96
6
+ metadata.gz: d15bffd5530b1d267c48f833d4a8f8711538eb8d4bcf48e21acdfe7247565f239dc46c0ce3938fa0e5b86727faf9afa4a86e3f32507ad9b590edeb968622c7c6
7
+ data.tar.gz: 5d910f25059137ade7c625dc1d8ecb207ac93cc199aa03385bc91f9c359a9233a5858481df5a598b4f3f80293e3807bdcf1b03f1cf838e4c6a03cfe807a08075
data/CHANGELOG.md.orig CHANGED
@@ -1,3 +1,11 @@
1
+ ### 2.0.13
2
+
3
+ 2023-04-15 19:57
4
+
5
+ #### NEW
6
+
7
+ - Option to include blockquotes (>) in output
8
+
1
9
  ### 2.0.12
2
10
 
3
11
  2023-04-15 19:28
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- snibbets (2.0.12)
4
+ snibbets (2.0.13)
5
5
  tty-which (~> 0.5, >= 0.5.0)
6
6
 
7
7
  GEM
data/README.md CHANGED
@@ -1,19 +1,14 @@
1
- # Snibbets
2
1
 
3
- [![RubyGems.org](https://img.shields.io/gem/v/snibbets)](https://rubygems.org/gems/snibbets)
4
- [![GitHub Actions](https://github.com/ttscoff/snibbets/actions/workflows/check.yml/badge.svg)](https://github.com/ttscoff/snibbets/actions/workflows/check.yml)
5
-
6
- <!--README-->
7
2
  A tool for accessing code snippets contained in a folder of plain text Markdown files.
8
3
 
9
4
  Snibbets allows me to keep code snippets in raw files, not relying on a dedicated code snippet app. I can collect and edit my snippets using a text editor, nvALT (nvUltra), or simply by saving snippets from my clipboard to a text file using *NIX redirection on the command line. I can add descriptive names and extended descriptions/notes to code snippets using standard Markdown.
10
5
 
11
6
  What Snibbets does is simply allow a quick search for a specific snippet that I can either output to the terminal, pipe to my clipboard, or access via LaunchBar (via the included LaunchBar Action). It's basically a wrapper for `find` and `grep` with the ability to separate code blocks from other text in my Markdown files.
12
7
 
13
- <!--GITHUB-->
8
+
14
9
  ![Snibbets in action](https://cdn3.brettterpstra.com/uploads/2023/04/snibbets2.gif)
15
- <!--END GITHUB-->
16
- <!--JEKYLL{% gif /uploads/2023/04/snibbets2.gif %}-->
10
+
11
+
17
12
 
18
13
  ## Collecting Snippets
19
14
 
@@ -56,12 +51,12 @@ Snibbets requires Ruby 3.0+. On recent versions of macOS, this is not included b
56
51
 
57
52
  If available, menus are generated by [fzf] or [gum]. If neither are available, a basic Readline menu system will be displayed, so neither are required, just nice to have as they provide fuzzy filtering, scrolling, and type-ahead completion.
58
53
 
59
- [homebrew]: https://brew.sh/ "HomebrewThe Missing Package Manager for macOS (or Linux)"
54
+ [homebrew]: https://brew.sh/ "Homebrew???The Missing Package Manager for macOS (or Linux)"
60
55
  [rbenv]: https://github.com/rbenv/rbenv "rbenv/rbenv:Manage your app's Ruby environment"
61
56
  [rvm]: https://rvm.io/ "Ruby Version Manager"
62
57
  [asdf]: https://asdf-vm.com/ "ASDF environment manager"
63
58
  [fzf]: https://github.com/junegunn/fzf "junegunn/fzf:A command-line fuzzy finder"
64
- [gum]: https://github.com/charmbracelet/gum "charmbracelet/gum:A tool for glamorous shell scripts 🎀"
59
+ [gum]: https://github.com/charmbracelet/gum "charmbracelet/gum:A tool for glamorous shell scripts ????"
65
60
 
66
61
  ### Installation
67
62
 
@@ -86,6 +81,7 @@ copy: false
86
81
  editor:
87
82
  extension: md
88
83
  highlight: false
84
+ include_blockquotes: false
89
85
  interactive: true
90
86
  launchbar: false
91
87
  menus:
@@ -110,6 +106,8 @@ The `editor` setting is used to open the config file, and to open snippets for e
110
106
 
111
107
  The `highlight` key turns on syntax highlighting. This requires that either `pygmentize` or `skyligting` is available on your system (both available via package managers like Homebrew). This feature is still in development and results may be mixed.
112
108
 
109
+ The `include_blockquotes` setting determines whether blockquotes are included in the output. By default, Snibbets removes everything other than code blocks (indented or fenced) from the output it displays. But if you want to include a note that you'll see on the command line, you can put it in a block quote by preceding each line you want to preserve with a right angle bracket (`>`).
110
+
113
111
  The `interactive` setting determines whether menus will be displayed. This should generally be true, but if you want silent operation that just displays the best match automatically, set it to false.
114
112
 
115
113
  The `menus` setting will determine what method is used for displaying interactive menus. If this is not set, it will be automatically determined in the order of `fzf`, `gum`, and `console`. You can manually choose to use one of these options over another by making it the `menus` setting.
@@ -118,20 +116,25 @@ The `name_only` key will permanently set Snibbets to only search for snippets by
118
116
 
119
117
  ### Usage
120
118
 
121
- Usage: snibbets [options] query
122
- -a, --all If a file contains multiple snippets, output all of them (no menu)
123
- -c, --[no-]copy Copy the output to the clibpoard (also displays on STDOUT)
124
- -e, --edit Open the selected snippet in your configured editor
125
- -n, --[no-]name-only Only search file names, not content
126
- -o, --output FORMAT Output format (json|launchbar|*raw)
127
- -p, --paste Interactively create a new snippet from clipboard contents (Mac only)
128
- -q, --quiet Skip menus and display first match
129
- -s, --source FOLDER Snippets folder to search
130
- --configure Open the configuration file in your default editor
131
- --highlight Use pygments or skylighting to syntax highlight (if installed)
132
- --save Save the current command line options to the YAML configuration
133
- -h, --help Display this screen
134
- -v, --version Display version information
119
+ ```
120
+ Snibbets v2.0.13
121
+
122
+ Usage: snibbets [options] query
123
+ -a, --all If a file contains multiple snippets, output all of them (no menu)
124
+ -c, --[no-]copy Copy the output to the clibpoard (also displays on STDOUT)
125
+ -e, --edit Open the selected snippet in your configured editor
126
+ -n, --[no-]name-only Only search file names, not content
127
+ -o, --output FORMAT Output format (json|launchbar|*raw)
128
+ -p, --paste, --new Interactively create a new snippet from clipboard contents (Mac only)
129
+ -q, --quiet Skip menus and display first match
130
+ -s, --source FOLDER Snippets folder to search
131
+ --configure Open the configuration file in your default editor
132
+ --[no-]blockquotes Include block quotes in output
133
+ --highlight Use pygments or skylighting to syntax highlight (if installed)
134
+ --save Save the current command line options to the YAML configuration
135
+ -h, --help Display this screen
136
+ -v, --version Display version information
137
+ ```
135
138
 
136
139
  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.
137
140
 
@@ -173,4 +176,3 @@ Once installed, run the action (type `snib` and hit return on the result) to sel
173
176
  ### Usage
174
177
 
175
178
  Type `snib` to bring the Action up, then hit Space to enter your query text. Matching files will be presented. If the selected file contains more than one snippet, a list of snippets (based on ATX headers in the file) will be presented as a child menu. Selecting a snippet and hitting return will copy the associated code block to the clipboard.
176
- <!--END README-->
data/bin/snibbets CHANGED
@@ -64,6 +64,10 @@ module Snibbets
64
64
  @arguments[:edit_config] = true
65
65
  end
66
66
 
67
+ opts.on('--[no-]blockquotes', 'Include block quotes in output') do |v|
68
+ options[:include_blockquotes] = v
69
+ end
70
+
67
71
  opts.on('--highlight', 'Use pygments or skylighting to syntax highlight (if installed)') do
68
72
  options[:highlight] = true
69
73
  end
data/buildnotes.md CHANGED
@@ -1,6 +1,6 @@
1
1
  template: gem, git, gli, project
2
2
  executable: na
3
- readme: README.md
3
+ readme: src/README.md
4
4
  changelog: CHANGELOG.md
5
5
  project: snibbets
6
6
 
@@ -20,6 +20,7 @@ You no longer need to manually bump the version, it will be incremented when thi
20
20
  #!/bin/bash
21
21
 
22
22
  changelog -u
23
+ scripts/fixreadme.rb
23
24
  changelog | git commit -a -F -
24
25
  git pull
25
26
  git push
@@ -29,6 +30,8 @@ git push
29
30
  @include(project:Update Blog Project) Update Blog Project
30
31
  @run(rake bump[patch]) Bump Version
31
32
 
33
+ @run(git commit -am 'Version bump')
34
+
32
35
  @after
33
36
  Don't forget to publish the website!
34
37
  @end
@@ -10,6 +10,7 @@ module Snibbets
10
10
  editor: nil,
11
11
  extension: 'md',
12
12
  highlight: false,
13
+ include_blockquotes: false,
13
14
  interactive: true,
14
15
  launchbar: false,
15
16
  menus: nil,
@@ -107,7 +107,17 @@ module Snibbets
107
107
  counter = 0
108
108
  code_blocks = {}
109
109
 
110
- sans_blocks = content.gsub(/^(`{3,})(\w+)?\s*\n(.*?)\n\1/m) do
110
+ sans_blocks = content.dup
111
+
112
+ if Snibbets.options[:include_blockquotes]
113
+ sans_blocks = sans_blocks.gsub(/(?mi)(^(>.*?)(\n|$))+/) do
114
+ counter += 1
115
+ code_blocks["block#{counter}"] = Regexp.last_match(0).gsub(/^> *(?=\S)/, '# ')
116
+ "<block#{counter}>\n"
117
+ end
118
+ end
119
+
120
+ sans_blocks = sans_blocks.gsub(/^(`{3,})(\w+)?\s*\n(.*?)\n\1/m) do
111
121
  counter += 1
112
122
  code_blocks["block#{counter}"] = Regexp.last_match(3)
113
123
  "<block#{counter}>\n"
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Snibbets
4
- VERSION = '2.0.12'
4
+ VERSION = '2.0.13'
5
5
  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.12
4
+ version: 2.0.13
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brett Terpstra