Skip to content

Commit ef8c81d

Browse files
authored
kbs2-snip: make config consistent (#329)
* contrib: make kbs2-snip's config consistent with others Other commands use `chooser`, not `matcher`. * CHANGELOG: record changes * CHANGELOG: add link * kbs2-snip: update top-level doc
1 parent 125c57e commit ef8c81d

File tree

3 files changed

+9
-6
lines changed

3 files changed

+9
-6
lines changed

CHANGELOG.md

+3
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@ configuration and/or store directories to the directories listed in their
3232
`$XDG_CONFIG_HOME` and `$XDG_DATA_HOME` directories for config and store data,
3333
respectively ([#315](https://github.com/woodruffw/kbs2/pull/315))
3434

35+
* Contrib: `kbs2 snip` now checks `commands.ext.snip.chooser` instead of
36+
`commands.ext.snip.matcher` ([#329](https://github.com/woodruffw/kbs2/pull/329))
37+
3538
### Removed
3639

3740
* CLI: The `-g`, `--generate` flag has been removed from `kbs2 new`. Generation

contrib/ext-cmds/kbs2-snip/README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,14 @@ See the configuration options below for alternatives.
1515

1616
## Configuration
1717

18-
`kbs2-snip` reads the `commands.ext.snip.matcher` setting in the configuration
18+
`kbs2-snip` reads the `commands.ext.snip.chooser` setting in the configuration
1919
file to determine which fuzzy finder to use.
2020

2121
For example:
2222

2323
```toml
2424
[commands.snip]
25-
matcher = "fzf"
25+
chooser = "fzf"
2626
```
2727

2828
...will cause `kbs2-snip` to use [`fzf`](https://github.com/junegunn/fzf).

contrib/ext-cmds/kbs2-snip/kbs2-snip

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
#!/usr/bin/env ruby
22
# frozen_string_literal: true
33

4-
# kbs2-snip: quickly select and run a code snippet stored in kbs2 using a fuzzy matcher
5-
# By default, selecta is used as the fuzzy matcher.
4+
# kbs2-snip: quickly select and run a code snippet stored in kbs2 using a fuzzy selector
5+
# By default, selecta is used as the fuzzy selector.
66

77
require "open3"
88
require "optparse"
@@ -23,7 +23,7 @@ end.parse!
2323

2424
config = JSON.parse `kbs2 config dump`
2525

26-
matcher = config.dig("commands", "ext", "snip", "matcher") || "selecta"
26+
chooser = config.dig("commands", "ext", "snip", "chooser") || "selecta"
2727

2828
unstructureds = `kbs2 list -k unstructured`.split
2929
snippets = unstructureds.filter_map do |label|
@@ -33,7 +33,7 @@ snippets = unstructureds.filter_map do |label|
3333
["#{label} - #{contents[8..]}", contents[8..]] if contents.start_with? "snippet:"
3434
end.to_h
3535

36-
output, = Open3.capture2 matcher, stdin_data: snippets.keys.join("\n")
36+
output, = Open3.capture2 chooser, stdin_data: snippets.keys.join("\n")
3737
selection = output.chomp
3838
code = snippets[selection]
3939

0 commit comments

Comments
 (0)