cli-ui 2.0.0 → 2.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +6 -0
- data/lib/cli/ui/spinner/spin_group.rb +16 -4
- data/lib/cli/ui/spinner.rb +1 -1
- data/lib/cli/ui/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: eb23f8ab0044a484b7f6f8dcb57240d5b5ba9a3db6caedb6090186c3d7a55143
|
4
|
+
data.tar.gz: 9c3e0d024f05ed428a0afa190fbc440008e58d8f58cf244c452259722883dd50
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
data/lib/cli/ui/spinner.rb
CHANGED
data/lib/cli/ui/version.rb
CHANGED
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.
|
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-
|
13
|
+
date: 2022-11-28 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: minitest
|