cli-ui 2.0.0 → 2.1.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d8dec5198cdbbb3a6060fc448a9a03b5bc6eca461b94a62ead0f128664bb0ee2
4
- data.tar.gz: bed02e7e27771141c08859c11d7e01f690438bb46d4022f5225d8cb42e39efe4
3
+ metadata.gz: eb23f8ab0044a484b7f6f8dcb57240d5b5ba9a3db6caedb6090186c3d7a55143
4
+ data.tar.gz: 9c3e0d024f05ed428a0afa190fbc440008e58d8f58cf244c452259722883dd50
5
5
  SHA512:
6
- metadata.gz: 6944f7c1b8492e69bd078b2ca0d9901d26694e4542976cb07729efff2cb59438cbc2ec61692b75ccf178ffcec896a297264be5734520695f9bc11779f2698ead
7
- data.tar.gz: c9795b1749d3db7cb57bccca815495ed9b2e8ee02092fe95b46bf451f2993e65c33f8b48e9f6520b2984b7278db64cb9e92bb1fe58a761691a9b313dab6ef464
6
+ metadata.gz: 36dccad36f8cc8eeff6bc9ad2e7deb2e37427ccf5887fb543d27485ff5cfc8e441355edc9cb92f954eef9e1a45fb5d2d78e8b84b510dec12809e3e1df2071cea
7
+ data.tar.gz: 31c99ff115d4061d4f9441063177784f9f6656cafee9bd6b85fc6d48e30ab855e4cf83138d8f305fb86542edd4fbe2226db26cf448e70b3b8677bf18ce4a388c
data/README.md CHANGED
@@ -175,6 +175,12 @@ end
175
175
 
176
176
  ---
177
177
 
178
+ ## Sorbet
179
+
180
+ We make use of [Sorbet](https://sorbet.org/) in cli-ui. We provide stubs for Sorbet so that you can use this gem even
181
+ if you aren't using Sorbet. We activate these stubs if `T` is undefined when the gem is loaded. For this reason, if you
182
+ would like to use this gem and your project _does_ use Sorbet, ensure you load Sorbet _before_ loading cli-ui.
183
+
178
184
  ## Example Usage
179
185
 
180
186
  The following code makes use of nested-framing, multi-threaded spinners, formatted text, and more.
@@ -11,7 +11,7 @@ module CLI
11
11
  #
12
12
  # ==== Options
13
13
  #
14
- # * +:auto_debrief+ - Automatically debrief exceptions? Default to true
14
+ # * +:auto_debrief+ - Automatically debrief exceptions or through success_debrief? Default to true
15
15
  #
16
16
  # ==== Example Usage
17
17
  #
@@ -273,6 +273,16 @@ module CLI
273
273
  @failure_debrief = block
274
274
  end
275
275
 
276
+ # Provide a debriefing for successful tasks
277
+ sig do
278
+ params(
279
+ block: T.proc.params(title: String, out: String, err: String).void,
280
+ ).void
281
+ end
282
+ def success_debrief(&block)
283
+ @success_debrief = block
284
+ end
285
+
276
286
  sig { returns(T::Boolean) }
277
287
  def all_succeeded?
278
288
  @m.synchronize do
@@ -286,13 +296,15 @@ module CLI
286
296
  def debrief
287
297
  @m.synchronize do
288
298
  @tasks.each do |task|
289
- next if task.success
290
-
291
299
  title = task.title
292
- e = task.exception
293
300
  out = task.stdout
294
301
  err = task.stderr
295
302
 
303
+ if task.success
304
+ next @success_debrief&.call(title, out, err)
305
+ end
306
+
307
+ e = task.exception
296
308
  next @failure_debrief.call(title, e, out, err) if @failure_debrief
297
309
 
298
310
  CLI::UI::Frame.open('Task Failed: ' + title, color: :red, timing: Time.new - @start) do
@@ -61,7 +61,7 @@ module CLI
61
61
  #
62
62
  # ==== Options
63
63
  #
64
- # * +:auto_debrief+ - Automatically debrief exceptions? Default to true
64
+ # * +:auto_debrief+ - Automatically debrief exceptions or through success_debrief? Default to true
65
65
  #
66
66
  # ==== Block
67
67
  #
@@ -2,6 +2,6 @@
2
2
 
3
3
  module CLI
4
4
  module UI
5
- VERSION = '2.0.0'
5
+ VERSION = '2.1.0'
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cli-ui
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 2.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Burke Libbey
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: exe
12
12
  cert_chain: []
13
- date: 2022-11-18 00:00:00.000000000 Z
13
+ date: 2022-11-28 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: minitest