cli-mastermind 1.2.3 → 1.2.4

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: 24aff2be94a0113a809e45983fc8a528d99bfbdc4090db68c9b00d9e9e7d8416
4
- data.tar.gz: 95059050f8d96aabebaf8b3f18798c0183ef7bf4731e223dba4748172ec55e04
3
+ metadata.gz: 78d5896d7e30cbc525db20203826c87eaccd257b8affa8fd27581123da546cd1
4
+ data.tar.gz: 9c3a443101cee50328a0b2d7abed17054bf9fd6e6aac7b5480e812b5bf4a723d
5
5
  SHA512:
6
- metadata.gz: 1809e4b280983a05468a89e9a2b9bf2a92c781e9ee5aa92e0aeff1ebfd9d0fbd321bbce2cb39c27e99ebf19d472573d511f3b57fd24be66adda305c687b92f21
7
- data.tar.gz: 9b2cb023a9a1898809b74822d20ab0f1f5dd5323d1b9fb9cfed914332154a05244bb7b676443197e33155da5f7b01c8a630228fe7ab6cdb7859849930b6f6921
6
+ metadata.gz: a0c618d6e0046a26d6ef0c7a9d507542c7e8aefc3cf10949fb58c11bbe2b488466d80d70e162b8e9e50e51ba270aeedfcfe53a54928e48a2eaf38933704a4ec7
7
+ data.tar.gz: 60b5602a9c4732974f0165e69b684668eb0fe3861d133f3117f88787db9b0a2a23e32482716de42ae3af6ece9be13f4a27bb42ffac1ca566d5e786e154c42ee4
@@ -30,8 +30,8 @@ module CLI
30
30
  def self.add_attribute(attribute)
31
31
  return if self.method_defined? attribute
32
32
 
33
- define_method "#{attribute}=" do |new_value=nil,&block|
34
- self.instance_variable_set("@#{attribute}", new_value||block) if self.instance_variable_get("@#{attribute}").nil?
33
+ define_method "#{attribute}=" do |new_value=nil, &block|
34
+ self.instance_variable_set("@#{attribute}", new_value.nil? ? block : new_value) if self.instance_variable_get("@#{attribute}").nil?
35
35
  end
36
36
 
37
37
  define_method attribute do
@@ -123,6 +123,19 @@ module CLI::Mastermind::UserInterface
123
123
  string.gsub(/[-_-]/, ' ').split(' ').map(&:capitalize).join(' ')
124
124
  end
125
125
 
126
+ # Capture the output of the given command and print them in a cli-ui friendly way.
127
+ # This command is an ease of use wrapper around a common capture construct.
128
+ #
129
+ # The command given can be a single string, an array of strings, or individual
130
+ # arguments. The command and any kwargs given are passed to IO.popen to capture
131
+ # output.
132
+ #
133
+ # @see IO.popen
134
+ # @see Open3.popen
135
+ def capture_command_output(*command, **kwargs)
136
+ IO.popen(command.flatten, **kwargs) { |io| io.each_line { |line| puts line } }
137
+ end
138
+
126
139
  class AsyncSpinners < CLI::UI::SpinGroup
127
140
  attr_reader :results
128
141
 
@@ -8,7 +8,7 @@ module CLI
8
8
  module VERSION
9
9
  RELEASE = 1
10
10
  MAJOR = 2
11
- MINOR = 3
11
+ MINOR = 4
12
12
  PATCH = nil
13
13
 
14
14
  STRING = [RELEASE, MAJOR, MINOR, PATCH].compact.join('.').freeze
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cli-mastermind
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.3
4
+ version: 1.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Hall
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-11-15 00:00:00.000000000 Z
11
+ date: 2019-12-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: cli-ui