dry-cli-help 0.5.0 → 0.5.1

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: 10fb8e86e571ad96c6f523f4807d040b0421ebe1fa65e334738fa785e0212196
4
- data.tar.gz: 408f6dd175e32d407f38306c9c61211a9b8e9d7e82f8870cde02ce58cfe64a23
3
+ metadata.gz: bf20fa0aacf131ed2906f0db379bc73dff9e6f73d106e9748f9db3efb589892c
4
+ data.tar.gz: 2407d232a6fc663f175431e8c907b1352e6ec13cda833a64530ea1f53e58b58c
5
5
  SHA512:
6
- metadata.gz: f42c06e5cb90eae00d6fc11f1fa4cbfed1f789005b4aa6dc0ea27cd60522de63019804c154e818efc4eb4bc52e673765ad638f881f94faa445b0b1a6ce637060
7
- data.tar.gz: 9e711ac3f6b30580e1e979f391019de8f1c5d155b9ded6b1c72881e698d79347e337299aca96316b9c9806507d9b1d7022c0f30d9bf715083e60a7a651775c82
6
+ metadata.gz: aaf06bce6593191d6fe7ef465df68afd6679877e1b412f8c8a654c04420b24229268c8a82a4ac9766e3d063a4b34c790636ea2aa15de77327bb291ae131755d8
7
+ data.tar.gz: 9c790e6b9b235577b2f92ffacf0f6648c4164ceaa00192f343e1dcb2aeae93326368f9bdace5c90763acc14fcc70411010306141881d778bcf8201142c1e7ffc
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [0.5.1] - 2026-09-21
4
+
5
+ - An empty example, `example [""]`, no longer raises `NoMethodError` and takes the whole help screen with it. It prints the program name on its own, which is what a command that runs with no arguments means by it.
6
+
3
7
  ## [0.5.0] - Unreleased
4
8
 
5
9
  - The `dry-cli` dependency no longer pins a version range; any release satisfies it.
@@ -55,10 +55,15 @@ module Dry
55
55
 
56
56
  # Examples align among themselves: a full command line is longer than
57
57
  # any option, and would push every other description off to the right.
58
+ #
59
+ # An empty example is how a command says "run me with nothing at
60
+ # all", and String#split answers [] for it, so `line` is nil and only
61
+ # the program name is left to print.
58
62
  def render_examples
59
63
  rows = command.examples.map do |example|
60
64
  line, comment = example.split(" # ", 2)
61
- Row.new(term: "#{prog_name} #{line.strip}", text: comment&.strip,
65
+ term = [prog_name, line&.strip].reject { it.nil? || it.empty? }.join(" ")
66
+ Row.new(term: term, text: comment&.strip,
62
67
  term_style: :example, text_style: :example_comment)
63
68
  end
64
69
  section(:examples, format.definitions(rows, format.column_for(rows)))
@@ -9,7 +9,7 @@ module Dry
9
9
  # inherits from Object, so an empty reopening is compatible either way.
10
10
  class CLI
11
11
  module Help
12
- VERSION = "0.5.0"
12
+ VERSION = "0.5.1"
13
13
  end
14
14
  end
15
15
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dry-cli-help
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Konstantin Gredeskoul