lib/cli/mastermind/user_interface.rb
# Capture the output of the given command and print them in a cli-ui friendly way.
# This command is an ease of use wrapper around a common capture construct.
#
# The command given can be a single string, an array of strings, or individual
# arguments.  The command and any kwargs given are passed to IO.popen to capture
# output.
#
# Optionally, a block may be passed to modify the output of the line prior to
# printing.
#
# @param command [Array<String>] the command to execute
# @param kwargs [Hash] additional arguments to be passed into +IO.popen+
#
# @yieldparam line [String] a line of output to be processed
#
# @see IO.popen
# @see Open3.popen
Capture the output of the given command and print them in a cli-ui friendly way.
This command is an ease of use wrapper around a common capture construct.

The command given can be a single string, an array of strings, or individual
arguments.  The command and any kwargs given are passed to IO.popen to capture
output.

Optionally, a block may be passed to modify the output of the line prior to
printing.
Capture the output of the given command and print them in a cli - ui friendly way . This command is an ease of use wrapper around a common capture construct . The command given can be a single string an array of strings or individual arguments . The command and any kwargs given are passed to IO . popen to capture output . Optionally a block may be passed to modify the output of the line prior to printing .
def capture_command_output(*command, **kwargs, &block)
    block ||= -> line { line }
    IO.popen(command.flatten, **kwargs) { |io| io.each_line { |line| print block.call(line) } }
  end
def capture_command_output ( * command , ** kwargs , & block ) block ||= -> line { line } IO . popen ( command . flatten , ** kwargs ) { | io | io . each_line { | line | print block . call ( line ) } } end
Capture the output of the given command and print them in a cli-ui friendly way.
Capture the output of the given command and print them in a cli - ui friendly way .
# Default block returns what's passed in
command
the command to execute
the command to execute
kwargs
additional arguments to be passed into +IO.popen+
additional arguments to be passed into + IO . popen +
block
<not_specific>
line
<not_specific>
a line of output to be processed
a line of output to be processed
see
None
see
None