command_kit 0.5.4 → 0.5.5

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: 83223487d6792cceec7a536b0c081e86c85f14b6eb57007e2dfeade8c61f5d46
4
- data.tar.gz: f36a7a1867c6d992fccdf06827150f68e3c417c9a314509ddd24f7581acb2a7c
3
+ metadata.gz: 1a99a41f5bf2442e5523f9f7019dcd6b916f1b645786eefa9b0fb2a84aadd28c
4
+ data.tar.gz: 3fb73eaa7b3a5730baafd0d0bd02cc567e82020acc96dec6a87bf726666f4250
5
5
  SHA512:
6
- metadata.gz: 4def910755bee46456d5104ffad06fb2b6ba4d048aaed137595c08eea9dfe602603ccc2f7f46771b4ab4de2f27bd2e7e1feb5f0e4b5de3a2e6321f316ed6a28b
7
- data.tar.gz: 33dc0be92e533bf131edb88570a13677b9841fdd83f7c676b2ba12fe4d3693d974081a922e11e44a747a7854c0604ec4bdaf372ddb7909137c4568caa1a7d9ba
6
+ metadata.gz: 44673dd7cb91fe176210e319c4055010c4e81af5dabf7eb420b202c1d42637e4844a1f5c99e0d81eeb52d32bfe9221de843b86c8d1f7fc91cc4aece561b46402
7
+ data.tar.gz: 2470a9c111f829fc858c03f8b9be2726028d59da449bd68f778f7d87dc3f6bd93051ad4339ea896fa15f81dbcba3fe06af0b3b1b72f4705108a6cbab5157cba1
data/ChangeLog.md CHANGED
@@ -1,3 +1,16 @@
1
+ ### 0.5.5 / 2024-04-08
2
+
3
+ #### CommandKit::Interactive
4
+
5
+ * Ensure that the interactive prompt is re-printed when no input is entered
6
+ and input is required from the user.
7
+
8
+ #### CommandKit::Options
9
+
10
+ * Do not pass an Array of Regexp captures for an option's value Regexp type
11
+ into an option's block, if the option's block only accepts one argument.
12
+ Instead, only pass the option's value as a String.
13
+
1
14
  ### 0.5.4 / 2024-03-14
2
15
 
3
16
  #### CommandKit::Options
@@ -74,9 +74,9 @@ module CommandKit
74
74
  prompt << " [#{default}]" if default
75
75
  prompt << ": "
76
76
 
77
- stdout.print(prompt)
78
-
79
77
  loop do
78
+ stdout.print(prompt)
79
+
80
80
  value = stdin.gets(chomp: true)
81
81
  value ||= '' # convert nil values (ctrl^D) to an empty String
82
82
 
@@ -307,15 +307,16 @@ module CommandKit
307
307
  end
308
308
 
309
309
  option_parser.on(*option.usage,option.type,*option.desc) do |value|
310
- @options[option.name] = if option.type.is_a?(Regexp) &&
311
- value.is_a?(Array)
312
- value.first
313
- else
314
- value
315
- end
310
+ if option.type.is_a?(Regexp) && value.is_a?(Array)
311
+ # separate the optiona value from the additional Regexp captures
312
+ value, *args = value
313
+ else
314
+ args = nil
315
+ end
316
316
 
317
- instance_exec(value,&option.block) if option.block
318
- end
317
+ @options[option.name] = value
318
+ instance_exec(value,*args,&option.block) if option.block
319
+ end
319
320
  end
320
321
  end
321
322
  end
@@ -2,5 +2,5 @@
2
2
 
3
3
  module CommandKit
4
4
  # command_kit version
5
- VERSION = "0.5.4"
5
+ VERSION = "0.5.5"
6
6
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: command_kit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.4
4
+ version: 0.5.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Postmodern
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-03-14 00:00:00.000000000 Z
11
+ date: 2024-04-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler