snippet_cli 0.5.3 → 0.6.0
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 +61 -0
- data/README.md +208 -13
- data/lib/snippet_cli/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: a2b1333c0ffe088c5c153dafe22ba67475c4e5d37474d0202bd2b23c2f92214e
|
|
4
|
+
data.tar.gz: 1b9ec79d1c68081368554fce7780534673a1495ff2cbb1675e8de216b3439ef0
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 78e94153958b10affbab3bbbc7a3820043b40d9106c8b176f0780d9c2a8ca4fb676de9410a100fcbca85f8afef1b3578903ef1e3e56e8ccad27522b9df8a01ff
|
|
7
|
+
data.tar.gz: 89ce495730a157baad743ff3de2928c224e7d6feaa3535ee4be0976d32b7c1f1d221981098b2c781e385d01d8ccf24d47666b8ecc5d853dc6240082cd137b190
|
data/CHANGELOG.md
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project are documented in this file.
|
|
4
|
+
|
|
5
|
+
The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
## [0.6.0] - 2026-09-15
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
|
|
12
|
+
- Installable Nix flake. `nix run github:ajmarkow/snippet_cli` runs the CLI without
|
|
13
|
+
installing the gem, and `overlays.default` lets Nix users refer to `snippet_cli`
|
|
14
|
+
by bare name in `environment.systemPackages` or `home.packages`.
|
|
15
|
+
- This changelog. The gemspec advertised a `changelog_uri` that pointed at a file
|
|
16
|
+
which did not exist.
|
|
17
|
+
|
|
18
|
+
### Changed
|
|
19
|
+
|
|
20
|
+
- **Require Ruby 3.2 or newer.** The runtime dependencies already needed it, so the
|
|
21
|
+
previous `>= 3.1.0` constraint let the gem install on a Ruby it could not run on.
|
|
22
|
+
Narrowing supported Ruby is why this is a minor release rather than a patch.
|
|
23
|
+
RubyGems resolves Ruby 3.1 users to 0.5.3, so they keep a working install.
|
|
24
|
+
|
|
25
|
+
## [0.5.3] - 2026-04-13
|
|
26
|
+
|
|
27
|
+
### Added
|
|
28
|
+
|
|
29
|
+
- Nix packaging: a `bundlerApp` derivation with a `gemConfig` patch that links the
|
|
30
|
+
`gum` binary into the path the `gum` gem expects.
|
|
31
|
+
|
|
32
|
+
### Fixed
|
|
33
|
+
|
|
34
|
+
- Replaced an implicit `it` block parameter with an explicit one, which Ruby 3.4
|
|
35
|
+
otherwise reinterprets.
|
|
36
|
+
|
|
37
|
+
## [0.5.2] - 2026-04-13
|
|
38
|
+
|
|
39
|
+
### Fixed
|
|
40
|
+
|
|
41
|
+
- Embedded the Espanso schema JSON under `lib/` so `check` resolves it from an
|
|
42
|
+
installed gem rather than only from a source checkout.
|
|
43
|
+
|
|
44
|
+
## [0.5.1] - 2026-04-13
|
|
45
|
+
|
|
46
|
+
### Fixed
|
|
47
|
+
|
|
48
|
+
- Gemspec packaging correction for files missing from the published gem.
|
|
49
|
+
|
|
50
|
+
## [0.5.0] - 2026-04-13
|
|
51
|
+
|
|
52
|
+
### Changed
|
|
53
|
+
|
|
54
|
+
- Restricted `spec.files` to an explicit allowlist, so the gem ships only `lib/`,
|
|
55
|
+
`exe/`, and the top-level README, CHANGELOG, and LICENSE.
|
|
56
|
+
|
|
57
|
+
[0.6.0]: https://github.com/ajmarkow/snippet_cli/compare/v0.5.3...v0.6.0
|
|
58
|
+
[0.5.3]: https://github.com/ajmarkow/snippet_cli/compare/v0.5.2...v0.5.3
|
|
59
|
+
[0.5.2]: https://github.com/ajmarkow/snippet_cli/compare/v0.5.1...v0.5.2
|
|
60
|
+
[0.5.1]: https://github.com/ajmarkow/snippet_cli/compare/v0.5.0...v0.5.1
|
|
61
|
+
[0.5.0]: https://github.com/ajmarkow/snippet_cli/releases/tag/v0.5.0
|
data/README.md
CHANGED
|
@@ -1,24 +1,210 @@
|
|
|
1
1
|
# snippet_cli
|
|
2
|
-
[](https://badge.fury.io/rb/snippet_cli)
|
|
3
2
|
|
|
4
|
-
|
|
3
|
+
 
|
|
4
|
+
|
|
5
|
+
A CLI gem for generating valid YAML snippet configs for [Espanso](https://espanso.org), with utilities to validate match files and detect conflicting triggers.
|
|
6
|
+
|
|
7
|
+

|
|
8
|
+
|
|
9
|
+
> [!TIP]
|
|
10
|
+
> To get started, run `snippet_cli new --save` to build a snippet interactively and append it directly to your config file.
|
|
5
11
|
|
|
6
12
|
## Installation
|
|
7
13
|
|
|
8
|
-
|
|
14
|
+
Needs Ruby 3.2 or newer.
|
|
15
|
+
|
|
16
|
+
| Platform | Supported |
|
|
17
|
+
| ------------------------------- | --------- |
|
|
18
|
+
| macOS (Apple Silicon and Intel) | Yes |
|
|
19
|
+
| Linux (`x86_64`, `arm64`) | Yes |
|
|
20
|
+
| Windows | No |
|
|
21
|
+
|
|
22
|
+
`snippet_cli` drives its prompts with [`gum`](https://github.com/charmbracelet/gum),
|
|
23
|
+
which ships as a platform-specific gem. No Windows build of that gem is published,
|
|
24
|
+
so Windows is not supported. WSL works, since it installs the Linux build.
|
|
25
|
+
|
|
26
|
+
### RubyGems
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
gem install snippet_cli
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
### Nix
|
|
33
|
+
|
|
34
|
+
The flake builds `snippet_cli` and every gem it needs against a pinned Ruby, and
|
|
35
|
+
wires up the [`gum`](https://github.com/charmbracelet/gum) binary for you. Nothing
|
|
36
|
+
is written to `~/.gem`, so the install cannot break when your system Ruby changes.
|
|
37
|
+
|
|
38
|
+
<details>
|
|
39
|
+
<summary><b>Run it without installing</b> — <code>nix run</code></summary>
|
|
40
|
+
|
|
41
|
+
Try the latest release straight from GitHub:
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
nix run github:ajmarkow/snippet_cli
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
Pass arguments after `--`:
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
nix run github:ajmarkow/snippet_cli -- new --save
|
|
51
|
+
nix run github:ajmarkow/snippet_cli -- check ~/.config/espanso/match/base.yml
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
</details>
|
|
55
|
+
|
|
56
|
+
<details>
|
|
57
|
+
<summary><b>Install into your profile</b> — <code>nix profile add</code></summary>
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
nix profile add github:ajmarkow/snippet_cli
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
On Nix older than 2.30, the subcommand is `install` instead of `add`:
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
nix profile install github:ajmarkow/snippet_cli
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
Then upgrade or remove it with:
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
nix profile upgrade snippet_cli
|
|
73
|
+
nix profile remove snippet_cli
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
</details>
|
|
77
|
+
|
|
78
|
+
<details>
|
|
79
|
+
<summary><b>Add it to your system config</b> — flake input, Home Manager, or NixOS</summary>
|
|
80
|
+
|
|
81
|
+
Add the flake as an input:
|
|
82
|
+
|
|
83
|
+
```nix
|
|
84
|
+
{
|
|
85
|
+
inputs = {
|
|
86
|
+
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
|
87
|
+
snippet_cli.url = "github:ajmarkow/snippet_cli";
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
Simplest: apply the overlay, then refer to the package by name everywhere `pkgs`
|
|
93
|
+
is in scope — no need to thread `system` through:
|
|
94
|
+
|
|
95
|
+
```nix
|
|
96
|
+
nixpkgs.overlays = [ inputs.snippet_cli.overlays.default ];
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
```nix
|
|
100
|
+
home.packages = [ pkgs.snippet_cli ]; # Home Manager
|
|
101
|
+
environment.systemPackages = [ pkgs.snippet_cli ]; # NixOS
|
|
102
|
+
```
|
|
9
103
|
|
|
10
|
-
|
|
104
|
+
Without the overlay, reach the package directly instead:
|
|
11
105
|
|
|
12
|
-
|
|
106
|
+
```nix
|
|
107
|
+
home.packages = [ inputs.snippet_cli.packages.${pkgs.system}.default ];
|
|
108
|
+
```
|
|
13
109
|
|
|
14
|
-
|
|
110
|
+
</details>
|
|
111
|
+
|
|
112
|
+
<details>
|
|
113
|
+
<summary><b>Build from a local checkout</b></summary>
|
|
114
|
+
|
|
115
|
+
```bash
|
|
116
|
+
git clone https://github.com/ajmarkow/snippet_cli
|
|
117
|
+
cd snippet_cli
|
|
118
|
+
nix build .#snippet_cli # result appears at ./result/bin/snippet_cli
|
|
119
|
+
nix run .#snippet_cli -- version
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
Flakes only see files tracked by git, so `git add` any new file before building.
|
|
123
|
+
|
|
124
|
+
</details>
|
|
125
|
+
|
|
126
|
+
> [!NOTE]
|
|
127
|
+
> The Nix commands above need flakes enabled. If your Nix predates flakes being
|
|
128
|
+
> on by default, prefix them with
|
|
129
|
+
> `--extra-experimental-features 'nix-command flakes'`.
|
|
130
|
+
|
|
131
|
+
## Features
|
|
132
|
+
|
|
133
|
+
### Interactive Snippet Builder
|
|
134
|
+
|
|
135
|
+
- Designed to make adding complex snippets to your Espanso config completely painless (`new` command).
|
|
136
|
+
- Handles quoting, escaping, and multiline replacements for you.
|
|
137
|
+
- Supports `trigger`, `triggers`, or `regex` for snippet matching.
|
|
138
|
+
- Supports all replacement types: `replace`, `markdown`, `html`, `image_path`.
|
|
139
|
+
- Supports advanced snippet options: `label`, `comment`, `search_terms`, and `word` trigger.
|
|
140
|
+
- Offers `--no-vars` and `--bare` flags on `new` for defining simpler snippets without the variable builder or advanced options.
|
|
141
|
+
- `--no-vars` - Snippet builder without variables.
|
|
142
|
+
- `--bare` - Bare-bones snippet builder with just basic trigger and replace types.
|
|
143
|
+
|
|
144
|
+
### Interactive Variable Builder
|
|
145
|
+
|
|
146
|
+
- Offers an interactive variable builder to define as many variables as you'd like.
|
|
147
|
+
- Can be invoked separately (`vars` command) to add variables to the `global_vars` array in your config.
|
|
148
|
+
- Supports the following variable types: `echo`, `random`, `choice`, `date`, `shell`, `script`, `form`, `clipboard`.
|
|
149
|
+
- No guessing at parameters or double-checking schema, asks for all required fields and prompts for optional ones if you choose to set them.
|
|
150
|
+
- Defined variables are shown as you enter your snippet text for easy reference.
|
|
151
|
+
- Warns you if you forgot to use a variable or referenced an undefined one.
|
|
152
|
+
- Allows you to re-order variables after defining them.
|
|
153
|
+
|
|
154
|
+
### Config Integration
|
|
155
|
+
|
|
156
|
+
- Automatically uses the Espanso default config path for appending variables or snippets to your match file(s).
|
|
157
|
+
- If you have multiple match files, the wizard will ask which one to append to.
|
|
158
|
+
- Supports piped output if you don't want to save directly to a match file. Use `--save` / `-s` to append directly.
|
|
159
|
+
|
|
160
|
+
### Utilities
|
|
161
|
+
|
|
162
|
+
- Validate a match file against the Espanso schema (`check` command).
|
|
163
|
+
- Detect duplicate triggers in a match file (`conflict` command).
|
|
164
|
+
|
|
165
|
+
## Commands
|
|
166
|
+
|
|
167
|
+
<details open>
|
|
168
|
+
<summary>More Info</summary>
|
|
169
|
+
|
|
170
|
+
| Command | Alias | Description |
|
|
171
|
+
| ---------- | ----- | ---------------------------------------------------------------------- |
|
|
172
|
+
| `new` | `n` | Interactively build and optionally save to your match file |
|
|
173
|
+
| `vars` | `v` | Interactively build a vars block and optionally save it to global_vars |
|
|
174
|
+
| `check` | `k` | Validate a match file against the Espanso schema |
|
|
175
|
+
| `conflict` | `c` | Detect duplicate triggers in a match file |
|
|
176
|
+
| `version` | — | Print the current version |
|
|
177
|
+
|
|
178
|
+
</details>
|
|
179
|
+
|
|
180
|
+
### Flags
|
|
181
|
+
|
|
182
|
+
<details>
|
|
183
|
+
<summary>More Info</summary>
|
|
184
|
+
|
|
185
|
+
| Flag | Alias | Commands | Description |
|
|
186
|
+
| ----------- | ----- | ------------------- | ------------------------------------------------------------------ |
|
|
187
|
+
| `--save` | `-s` | `new`, `vars` | Save output to match file |
|
|
188
|
+
| `--no-vars` | `-n` | `new` | Skip variable builder; still offers alt types and advanced options |
|
|
189
|
+
| `--bare` | `-b` | `new` | Trigger(s) + plaintext only; no vars, alt types, or advanced |
|
|
190
|
+
| `--file` | `-f` | `check`, `conflict` | Path to match file |
|
|
191
|
+
| `--trigger` | `-t` | `conflict` | Trigger(s) to look up (comma-separated or repeated) |
|
|
192
|
+
| `--help` | `-h` | all | Show help info for commands |
|
|
193
|
+
|
|
194
|
+
</details>
|
|
195
|
+
|
|
196
|
+
---
|
|
15
197
|
|
|
16
198
|
## Development
|
|
17
199
|
|
|
18
|
-
|
|
200
|
+
> [!NOTE]
|
|
201
|
+
> This project uses [devenv](https://devenv.sh) (Nix-based) for environment management. Use `devenv shell` for local development.
|
|
19
202
|
|
|
20
203
|
### First-time setup
|
|
21
204
|
|
|
205
|
+
<details>
|
|
206
|
+
<summary>Devenv Install Instructions</summary>
|
|
207
|
+
|
|
22
208
|
1. [Install Nix](https://nixos.org/download) and [devenv](https://devenv.sh/getting-started/)
|
|
23
209
|
2. Clone the repo:
|
|
24
210
|
```bash
|
|
@@ -37,20 +223,29 @@ This project uses [devenv](https://devenv.sh) (Nix-based) for environment manage
|
|
|
37
223
|
```bash
|
|
38
224
|
bundle exec rake spec
|
|
39
225
|
```
|
|
226
|
+
</details>
|
|
40
227
|
|
|
41
228
|
### Releasing a new version
|
|
42
229
|
|
|
230
|
+
<details>
|
|
231
|
+
<summary>Instructions</summary>
|
|
232
|
+
|
|
43
233
|
1. Update the version number in `lib/snippet_cli/version.rb`
|
|
44
234
|
2. Commit with the message containing `gem-release-ready` — CI will build and push the gem to RubyGems automatically once tests pass
|
|
45
235
|
|
|
46
|
-
|
|
236
|
+
</details>
|
|
237
|
+
|
|
238
|
+
### Additional Info
|
|
239
|
+
|
|
240
|
+
<details>
|
|
241
|
+
<summary>Contributing, Code of Conduct</summary>
|
|
47
242
|
|
|
48
|
-
|
|
243
|
+
#### Contributing
|
|
49
244
|
|
|
50
|
-
|
|
245
|
+
Bug reports and pull requests are welcome on GitHub at [ajmarkow/snippet_cli](https://github.com/ajmarkow/snippet_cli). This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/ajmarkow/snippet_cli/blob/master/CODE_OF_CONDUCT.md).
|
|
51
246
|
|
|
52
|
-
|
|
247
|
+
#### Code of Conduct
|
|
53
248
|
|
|
54
|
-
|
|
249
|
+
Everyone interacting in the SnippetCli project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/ajmarkow/snippet_cli/blob/master/CODE_OF_CONDUCT.md).
|
|
55
250
|
|
|
56
|
-
|
|
251
|
+
</details>
|
data/lib/snippet_cli/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: snippet_cli
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.6.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- AJ Markow
|
|
@@ -171,6 +171,7 @@ executables:
|
|
|
171
171
|
extensions: []
|
|
172
172
|
extra_rdoc_files: []
|
|
173
173
|
files:
|
|
174
|
+
- CHANGELOG.md
|
|
174
175
|
- LICENSE.txt
|
|
175
176
|
- README.md
|
|
176
177
|
- exe/snippet_cli
|
|
@@ -241,7 +242,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
241
242
|
requirements:
|
|
242
243
|
- - ">="
|
|
243
244
|
- !ruby/object:Gem::Version
|
|
244
|
-
version: 3.
|
|
245
|
+
version: 3.2.0
|
|
245
246
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
246
247
|
requirements:
|
|
247
248
|
- - ">="
|