cli-mastermind 1.2.4 → 1.2.5
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 +4 -4
- data/lib/cli/mastermind/user_interface.rb +7 -2
- data/lib/cli/mastermind/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3b0de9e93e04cee67c931bcb124cbcefd75c68c27a2f7d8e44eba083dd4f9fbf
|
4
|
+
data.tar.gz: 559924cdd1e35d6498b6ccb23def42fdd2d0a669b9fedae234d62e5837161e95
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 434badb48e238d256391e1667284ab24a1d67ffb7c79a4a38625b015a84b325daec31c8626cd5163abb215d49cab82dd874346100a2b811928534ef077b5bbc9
|
7
|
+
data.tar.gz: 1019f97fd8602609a1bedd3eb1ac578fe56da1c2376200fd0d04aeec366571f9b919ffc2a167618c435b3f5b20c541c241bf2484823c3a577dcad60080aee07d
|
@@ -130,10 +130,15 @@ module CLI::Mastermind::UserInterface
|
|
130
130
|
# arguments. The command and any kwargs given are passed to IO.popen to capture
|
131
131
|
# output.
|
132
132
|
#
|
133
|
+
# Optionally, a block may be passed to modify the output of the line prior to
|
134
|
+
# printing.
|
135
|
+
#
|
133
136
|
# @see IO.popen
|
134
137
|
# @see Open3.popen
|
135
|
-
def capture_command_output(*command, **kwargs)
|
136
|
-
|
138
|
+
def capture_command_output(*command, **kwargs, &block)
|
139
|
+
# Default block returns what's passed in
|
140
|
+
block ||= -> line { line }
|
141
|
+
IO.popen(command.flatten, **kwargs) { |io| io.each_line { |line| print block.call(line) } }
|
137
142
|
end
|
138
143
|
|
139
144
|
class AsyncSpinners < CLI::UI::SpinGroup
|