howzit 2.1.39 → 2.1.40

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: a934719a022ca2f6713474e797eb1a9662dc884a750c93648d4151506ae41571
4
- data.tar.gz: f261e5e733bd2d695cc76ce36e74096d357983301156c6b5b2ce5757aa3637eb
3
+ metadata.gz: c8f040ba3e136aeb10470c40de3cc8272209d176841686aa242dffee1b9fb33f
4
+ data.tar.gz: a0e263004a627de3104cb52bb47a04aecacb7eab2389b34819d2ece891331c42
5
5
  SHA512:
6
- metadata.gz: 9d928971e7280979fbfba50eedadedfadcf10ee31a26a4f94169c2cfe987706342fd3b826d781d89f4e3882fd87885e38b070352eae4b5e7a38c7fe06828046c
7
- data.tar.gz: 72cc6fcc43c31a8d1827a5e421ebe41f06120d1fb0c428bb0339daa3e5c39b8477e769830fc302552723804033502aea5354b62b2e914a4d2e2a8bca9ac7421b
6
+ metadata.gz: 3d1ce1e58eb28518b0c977f5012436909100cc48fa56dfbf1cedf01389fb02a1ef32823d99b74f065456c07d105f54a1a9dc236a6c73050251ec6180f935af0b
7
+ data.tar.gz: e9197120a0dd16ca9aefae85f4dde9f09f06efe56d034faf65eee180aeb5fad02fbe158d8a59b17b007622acfaa44da9aa82312159bc488d49c2f61e5a57568c
data/CHANGELOG.md CHANGED
@@ -1,3 +1,15 @@
1
+ ### 2.1.40
2
+
3
+ 2026-02-04 07:53
4
+
5
+ #### NEW
6
+
7
+ - Added a --test-search flag that exits 0 when a search term matches at least one topic and 1 otherwise, with no normal output, allowing shells and scripts to probe for howzit topics programmatically
8
+
9
+ #### IMPROVED
10
+
11
+ - Build note processing in test-search mode now short-circuits without auto-creating buildnotes and treats the absence of any note file as a clean non-match instead of an error
12
+
1
13
  ### 2.1.39
2
14
 
3
15
  2026-01-25 07:39
data/bin/howzit CHANGED
@@ -31,6 +31,10 @@ OptionParser.new do |opts|
31
31
 
32
32
  opts.on('-f', '--force', 'Continue executing after an error') { Howzit.options[:force] = true }
33
33
 
34
+ opts.on('--test-search TERM', 'Exit 0 if TERM matches any topic, 1 otherwise (no output)') do |term|
35
+ Howzit.options[:test_search] = term
36
+ end
37
+
34
38
  opts.on('-m', '--matching TYPE', MATCHING_OPTIONS,
35
39
  'Topics matching type', "(#{MATCHING_OPTIONS.join(', ').sub(/#{Howzit.options[:matching]}/, "*#{Howzit.options[:matching]}")})") do |c|
36
40
  Howzit.options[:matching] = c
@@ -0,0 +1,15 @@
1
+ function fish_command_not_found --description "Use howzit topics for unknown commands when available"
2
+ set cmd $argv[1]
3
+ set args $argv[2..-1]
4
+
5
+ # If a howzit topic matches the command name, run it instead
6
+ if howzit --test-search $cmd >/dev/null 2>&1
7
+ howzit -r $cmd $args
8
+ return $status
9
+ end
10
+
11
+ # Fall back to the default unknown-command message
12
+ echo "fish: Unknown command '$cmd'"
13
+ return 127
14
+ end
15
+
@@ -1126,6 +1126,15 @@ module Howzit
1126
1126
  Howzit.multi_topic_run = false
1127
1127
  end
1128
1128
 
1129
+ # Test-search mode: do not auto-create a build note; just check for a match
1130
+ if Howzit.options[:test_search]
1131
+ term = Howzit.options[:test_search]
1132
+ # If no note file can be found at all, treat as no match
1133
+ Process.exit(1) unless note_file
1134
+ matches = find_topic(term)
1135
+ Process.exit(matches.any? ? 0 : 1)
1136
+ end
1137
+
1129
1138
  unless note_file
1130
1139
  Process.exit 0 if Howzit.options[:list_runnable_titles] || Howzit.options[:list_topic_titles]
1131
1140
 
@@ -3,5 +3,5 @@
3
3
  # Primary module for this gem.
4
4
  module Howzit
5
5
  # Current Howzit version.
6
- VERSION = '2.1.39'
6
+ VERSION = '2.1.40'
7
7
  end
@@ -0,0 +1,22 @@
1
+ # howzit command-not-found handler for zsh
2
+ #
3
+ # When an unknown command is entered, this handler will check to see
4
+ # if there is a howzit topic matching the command name. If so, it
5
+ # runs `howzit -r <command> [args...]`. Otherwise, it falls back to
6
+ # the standard "command not found" behavior.
7
+
8
+ command_not_found_handler() {
9
+ local cmd="$1"
10
+ shift
11
+
12
+ # If a howzit topic matches the command name, run it instead
13
+ if howzit --test-search "$cmd" >/dev/null 2>&1; then
14
+ howzit -r "$cmd" "$@"
15
+ return $?
16
+ fi
17
+
18
+ # Fall back to the default unknown-command message
19
+ print "zsh: command not found: $cmd" >&2
20
+ return 127
21
+ }
22
+
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: howzit
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.39
4
+ version: 2.1.40
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brett Terpstra
@@ -294,6 +294,7 @@ files:
294
294
  - fish/completions/fisher.fish
295
295
  - fish/completions/howzit.fish
296
296
  - fish/functions/bld.fish
297
+ - fish/functions/howzit_command_not_found.fish
297
298
  - howzit.gemspec
298
299
  - lib/howzit.rb
299
300
  - lib/howzit/buildnote.rb
@@ -334,6 +335,7 @@ files:
334
335
  - spec/util_spec.rb
335
336
  - src/_README.md
336
337
  - update_readmes.rb
338
+ - zsh/howzit-command-not-found.zsh
337
339
  homepage: https://github.com/ttscoff/howzit
338
340
  licenses:
339
341
  - MIT