multish 0.1.0 → 0.2.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 +5 -5
- data/.gitignore +1 -0
- data/.rubocop.yml +74 -22
- data/lib/multish.rb +33 -7
- data/lib/multish/version.rb +1 -1
- data/multish.gemspec +9 -5
- metadata +55 -14
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
|
-
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: d76d493821db956c0ff89f1b06f65b9017130620400fbb58468c9c90f3417019
|
|
4
|
+
data.tar.gz: 89234f44a40082755499b5a7b0279cff4e147ed43bde517f457a651653d2b56b
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 215dc7043862bc9c4185730f74855cb74448b4d5627f674595ff2978c944c56f4bfc5f284f058123aec0a5f14325672479b42df494d10079dca3fcf3ebebc37a
|
|
7
|
+
data.tar.gz: '04969adf2a71b600d3cdf0d61d0d260c851fd6a49a12111d261cb2da2bb2b99dc793efea3966a2c2eecd23dbffb91ce53041bf82633d655d665171c96e1951d6'
|
data/.gitignore
CHANGED
data/.rubocop.yml
CHANGED
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
AllCops:
|
|
2
|
-
TargetRubyVersion: 2.
|
|
2
|
+
TargetRubyVersion: 2.4
|
|
3
3
|
DisplayCopNames: true
|
|
4
4
|
|
|
5
|
-
Rails:
|
|
6
|
-
Enabled: false
|
|
7
|
-
|
|
8
5
|
Style/SymbolArray:
|
|
9
6
|
Enabled: true
|
|
10
7
|
|
|
@@ -21,23 +18,22 @@ Style/ClassAndModuleChildren:
|
|
|
21
18
|
Enabled: false
|
|
22
19
|
EnforcedStyle: compact
|
|
23
20
|
|
|
24
|
-
|
|
21
|
+
Layout/SpaceInsideHashLiteralBraces:
|
|
25
22
|
EnforcedStyle: no_space
|
|
26
23
|
|
|
27
|
-
|
|
24
|
+
Naming/AccessorMethodName:
|
|
28
25
|
Enabled: false
|
|
29
26
|
|
|
30
|
-
|
|
27
|
+
Layout/LineLength:
|
|
31
28
|
Enabled: false
|
|
32
29
|
|
|
33
|
-
|
|
34
|
-
Enabled: false
|
|
35
|
-
EnforcedStyle: align_braces
|
|
36
|
-
|
|
37
|
-
Style/IndentationConsistency:
|
|
30
|
+
Layout/IndentationConsistency:
|
|
38
31
|
Enabled: true
|
|
39
32
|
|
|
40
|
-
Style/
|
|
33
|
+
Style/TrailingCommaInArrayLiteral:
|
|
34
|
+
EnforcedStyleForMultiline: comma
|
|
35
|
+
|
|
36
|
+
Style/TrailingCommaInHashLiteral:
|
|
41
37
|
EnforcedStyleForMultiline: comma
|
|
42
38
|
|
|
43
39
|
Style/NumericLiterals:
|
|
@@ -49,7 +45,7 @@ Lint/Void:
|
|
|
49
45
|
Style/Documentation:
|
|
50
46
|
Enabled: false
|
|
51
47
|
|
|
52
|
-
AccessModifierIndentation:
|
|
48
|
+
Layout/AccessModifierIndentation:
|
|
53
49
|
EnforcedStyle: outdent
|
|
54
50
|
|
|
55
51
|
Metrics/MethodLength:
|
|
@@ -70,10 +66,10 @@ Style/PerlBackrefs:
|
|
|
70
66
|
Style/RegexpLiteral:
|
|
71
67
|
Enabled: false
|
|
72
68
|
|
|
73
|
-
|
|
69
|
+
Layout/EndAlignment:
|
|
74
70
|
AutoCorrect: true
|
|
75
71
|
|
|
76
|
-
|
|
72
|
+
Layout/DefEndAlignment:
|
|
77
73
|
AutoCorrect: true
|
|
78
74
|
|
|
79
75
|
Style/RaiseArgs:
|
|
@@ -91,9 +87,6 @@ Style/Lambda:
|
|
|
91
87
|
Metrics/ModuleLength:
|
|
92
88
|
Enabled: false
|
|
93
89
|
|
|
94
|
-
Rails/HasAndBelongsToMany:
|
|
95
|
-
Enabled: false
|
|
96
|
-
|
|
97
90
|
Style/EachWithObject:
|
|
98
91
|
Enabled: false
|
|
99
92
|
|
|
@@ -106,7 +99,7 @@ Style/ClassVars:
|
|
|
106
99
|
Style/MultilineBlockChain:
|
|
107
100
|
Enabled: false
|
|
108
101
|
|
|
109
|
-
|
|
102
|
+
Naming/PredicateName:
|
|
110
103
|
Enabled: false
|
|
111
104
|
|
|
112
105
|
Style/DoubleNegation:
|
|
@@ -124,7 +117,7 @@ Style/NumericPredicate:
|
|
|
124
117
|
Style/TernaryParentheses:
|
|
125
118
|
Enabled: false
|
|
126
119
|
|
|
127
|
-
|
|
120
|
+
Naming/FileName:
|
|
128
121
|
Enabled: false
|
|
129
122
|
|
|
130
123
|
Style/IfUnlessModifier:
|
|
@@ -136,7 +129,7 @@ Style/RedundantSelf:
|
|
|
136
129
|
Lint/AssignmentInCondition:
|
|
137
130
|
Enabled: false
|
|
138
131
|
|
|
139
|
-
Lint/
|
|
132
|
+
Lint/LiteralAsCondition:
|
|
140
133
|
Enabled: false
|
|
141
134
|
|
|
142
135
|
Style/For:
|
|
@@ -150,3 +143,62 @@ Style/RescueModifier:
|
|
|
150
143
|
|
|
151
144
|
Style/GlobalVars:
|
|
152
145
|
Enabled: false
|
|
146
|
+
|
|
147
|
+
Gemspec/DateAssignment: # (new in 1.10)
|
|
148
|
+
Enabled: true
|
|
149
|
+
Layout/SpaceBeforeBrackets: # (new in 1.7)
|
|
150
|
+
Enabled: true
|
|
151
|
+
Lint/AmbiguousAssignment: # (new in 1.7)
|
|
152
|
+
Enabled: true
|
|
153
|
+
Lint/DeprecatedConstants: # (new in 1.8)
|
|
154
|
+
Enabled: true
|
|
155
|
+
Lint/DuplicateBranch: # (new in 1.3)
|
|
156
|
+
Enabled: true
|
|
157
|
+
Lint/DuplicateRegexpCharacterClassElement: # (new in 1.1)
|
|
158
|
+
Enabled: true
|
|
159
|
+
Lint/EmptyBlock: # (new in 1.1)
|
|
160
|
+
Enabled: true
|
|
161
|
+
Lint/EmptyClass: # (new in 1.3)
|
|
162
|
+
Enabled: true
|
|
163
|
+
Lint/LambdaWithoutLiteralBlock: # (new in 1.8)
|
|
164
|
+
Enabled: true
|
|
165
|
+
Lint/NoReturnInBeginEndBlocks: # (new in 1.2)
|
|
166
|
+
Enabled: true
|
|
167
|
+
Lint/NumberedParameterAssignment: # (new in 1.9)
|
|
168
|
+
Enabled: true
|
|
169
|
+
Lint/OrAssignmentToConstant: # (new in 1.9)
|
|
170
|
+
Enabled: true
|
|
171
|
+
Lint/RedundantDirGlobSort: # (new in 1.8)
|
|
172
|
+
Enabled: true
|
|
173
|
+
Lint/SymbolConversion: # (new in 1.9)
|
|
174
|
+
Enabled: true
|
|
175
|
+
Lint/ToEnumArguments: # (new in 1.1)
|
|
176
|
+
Enabled: true
|
|
177
|
+
Lint/TripleQuotes: # (new in 1.9)
|
|
178
|
+
Enabled: true
|
|
179
|
+
Lint/UnexpectedBlockArity: # (new in 1.5)
|
|
180
|
+
Enabled: true
|
|
181
|
+
Lint/UnmodifiedReduceAccumulator: # (new in 1.1)
|
|
182
|
+
Enabled: true
|
|
183
|
+
Style/ArgumentsForwarding: # (new in 1.1)
|
|
184
|
+
Enabled: true
|
|
185
|
+
Style/CollectionCompact: # (new in 1.2)
|
|
186
|
+
Enabled: true
|
|
187
|
+
Style/DocumentDynamicEvalDefinition: # (new in 1.1)
|
|
188
|
+
Enabled: true
|
|
189
|
+
Style/EndlessMethod: # (new in 1.8)
|
|
190
|
+
Enabled: true
|
|
191
|
+
Style/HashConversion: # (new in 1.10)
|
|
192
|
+
Enabled: true
|
|
193
|
+
Style/HashExcept: # (new in 1.7)
|
|
194
|
+
Enabled: true
|
|
195
|
+
Style/IfWithBooleanLiteralBranches: # (new in 1.9)
|
|
196
|
+
Enabled: true
|
|
197
|
+
Style/NegatedIfElseCondition: # (new in 1.2)
|
|
198
|
+
Enabled: true
|
|
199
|
+
Style/NilLambda: # (new in 1.3)
|
|
200
|
+
Enabled: true
|
|
201
|
+
Style/RedundantArgument: # (new in 1.4)
|
|
202
|
+
Enabled: true
|
|
203
|
+
Style/SwapValues: # (new in 1.1)
|
|
204
|
+
Enabled: true
|
data/lib/multish.rb
CHANGED
|
@@ -2,6 +2,7 @@ require 'multish/version'
|
|
|
2
2
|
|
|
3
3
|
require 'curses'
|
|
4
4
|
require 'open3'
|
|
5
|
+
require 'colorize'
|
|
5
6
|
|
|
6
7
|
class MultishItem
|
|
7
8
|
attr_reader :command
|
|
@@ -10,6 +11,7 @@ class MultishItem
|
|
|
10
11
|
@command = command
|
|
11
12
|
@index = index
|
|
12
13
|
@count = count
|
|
14
|
+
@output = ''
|
|
13
15
|
end
|
|
14
16
|
|
|
15
17
|
def width
|
|
@@ -40,23 +42,26 @@ class MultishItem
|
|
|
40
42
|
4
|
|
41
43
|
elsif finished?
|
|
42
44
|
errored? ? 3 : 2
|
|
43
|
-
else
|
|
45
|
+
else # rubocop:disable Lint/DuplicateBranch
|
|
44
46
|
4
|
|
45
47
|
end
|
|
46
48
|
end
|
|
47
49
|
|
|
48
50
|
def errored?
|
|
49
|
-
@exit_code &&
|
|
51
|
+
@exit_code && @exit_code != 0
|
|
50
52
|
end
|
|
51
53
|
|
|
52
54
|
def update_title!
|
|
53
55
|
@nav_window.setpos(0, 0)
|
|
54
56
|
@nav_window.attron(Curses.color_pair(color_code) | Curses::A_REVERSE | Curses::A_BOLD)
|
|
55
|
-
|
|
56
|
-
@nav_window.addstr(text.ljust(width - 1))
|
|
57
|
+
@nav_window.addstr(window_title.ljust(width - 1))
|
|
57
58
|
@nav_window.refresh
|
|
58
59
|
end
|
|
59
60
|
|
|
61
|
+
def window_title
|
|
62
|
+
finished? ? "[ #{command} ] -> #{@exit_code}" : "$ #{command}"
|
|
63
|
+
end
|
|
64
|
+
|
|
60
65
|
def open_process!
|
|
61
66
|
@stdin, @stdout, @stderr, @wait_thr = Open3.popen3(@command)
|
|
62
67
|
@stdin.close
|
|
@@ -66,25 +71,33 @@ class MultishItem
|
|
|
66
71
|
[@stdout, @stderr]
|
|
67
72
|
end
|
|
68
73
|
|
|
69
|
-
def try_update(fd)
|
|
70
|
-
return unless
|
|
74
|
+
def try_update(fd) # rubocop:disable Naming/MethodParameterName
|
|
75
|
+
return unless [@stdout, @stderr].include?(fd)
|
|
76
|
+
|
|
71
77
|
line = fd.gets
|
|
72
78
|
print(line) if line
|
|
73
79
|
end
|
|
74
80
|
|
|
75
81
|
def print(text)
|
|
82
|
+
@output << text
|
|
76
83
|
@window.addstr(text)
|
|
77
84
|
@window.refresh
|
|
78
85
|
end
|
|
79
86
|
|
|
80
87
|
def finished?
|
|
81
88
|
return false unless @wait_thr
|
|
89
|
+
|
|
82
90
|
ret = !@wait_thr.alive?
|
|
83
91
|
if ret && !@exit_code
|
|
84
92
|
@exit_code = @wait_thr.value
|
|
85
93
|
end
|
|
86
94
|
ret
|
|
87
95
|
end
|
|
96
|
+
|
|
97
|
+
def print_output!
|
|
98
|
+
warn window_title.red
|
|
99
|
+
warn @output
|
|
100
|
+
end
|
|
88
101
|
end
|
|
89
102
|
|
|
90
103
|
class Multish
|
|
@@ -92,6 +105,10 @@ class Multish
|
|
|
92
105
|
self.new.run!(args)
|
|
93
106
|
end
|
|
94
107
|
|
|
108
|
+
def errored?
|
|
109
|
+
@commands.any?(&:errored?)
|
|
110
|
+
end
|
|
111
|
+
|
|
95
112
|
def run!(args)
|
|
96
113
|
@commands = args.each_with_index.map { |arg, index| MultishItem.new(arg, index, args.count) }
|
|
97
114
|
Curses.init_screen
|
|
@@ -109,6 +126,7 @@ class Multish
|
|
|
109
126
|
while true
|
|
110
127
|
fdlist.reject!(&:closed?)
|
|
111
128
|
break if fdlist.empty?
|
|
129
|
+
|
|
112
130
|
ready = IO.select(fdlist)[0]
|
|
113
131
|
ready.each do |fd|
|
|
114
132
|
@commands.each { |command| command.try_update(fd) }
|
|
@@ -119,7 +137,15 @@ class Multish
|
|
|
119
137
|
ensure
|
|
120
138
|
Curses.curs_set(1)
|
|
121
139
|
Curses.close_screen
|
|
122
|
-
|
|
140
|
+
if errored?
|
|
141
|
+
warn 'At least one of the commands exited with error.'
|
|
142
|
+
@commands.select(&:errored?).each do |command|
|
|
143
|
+
command.print_output!
|
|
144
|
+
end
|
|
145
|
+
exit 1
|
|
146
|
+
else
|
|
147
|
+
exit 0
|
|
148
|
+
end
|
|
123
149
|
end
|
|
124
150
|
end
|
|
125
151
|
end
|
data/lib/multish/version.rb
CHANGED
data/multish.gemspec
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
lib = File.expand_path('../lib', __FILE__)
|
|
1
|
+
lib = File.expand_path('lib', __dir__)
|
|
3
2
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
3
|
require 'multish/version'
|
|
5
4
|
|
|
@@ -21,10 +20,15 @@ Gem::Specification.new do |spec|
|
|
|
21
20
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
|
22
21
|
spec.require_paths = ['lib']
|
|
23
22
|
|
|
24
|
-
spec.add_development_dependency 'bundler', '~>
|
|
25
|
-
spec.add_development_dependency 'rake', '~>
|
|
23
|
+
spec.add_development_dependency 'bundler', '~> 2.2'
|
|
24
|
+
spec.add_development_dependency 'rake', '~> 12.0'
|
|
26
25
|
spec.add_development_dependency 'rspec', '~> 3.0'
|
|
27
|
-
spec.add_development_dependency 'rubocop', '~> 0
|
|
26
|
+
spec.add_development_dependency 'rubocop', '~> 1.0'
|
|
27
|
+
spec.add_development_dependency 'rubocop-rake'
|
|
28
|
+
spec.add_development_dependency 'rubocop-rspec'
|
|
28
29
|
|
|
30
|
+
spec.add_runtime_dependency 'colorize'
|
|
29
31
|
spec.add_runtime_dependency 'curses'
|
|
32
|
+
|
|
33
|
+
spec.required_ruby_version = '>= 2.4.0'
|
|
30
34
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: multish
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.2.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Tomasz Dąbrowski
|
|
8
|
-
autorequire:
|
|
8
|
+
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2021-02-23 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bundler
|
|
@@ -16,28 +16,28 @@ dependencies:
|
|
|
16
16
|
requirements:
|
|
17
17
|
- - "~>"
|
|
18
18
|
- !ruby/object:Gem::Version
|
|
19
|
-
version: '
|
|
19
|
+
version: '2.2'
|
|
20
20
|
type: :development
|
|
21
21
|
prerelease: false
|
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
|
23
23
|
requirements:
|
|
24
24
|
- - "~>"
|
|
25
25
|
- !ruby/object:Gem::Version
|
|
26
|
-
version: '
|
|
26
|
+
version: '2.2'
|
|
27
27
|
- !ruby/object:Gem::Dependency
|
|
28
28
|
name: rake
|
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
|
30
30
|
requirements:
|
|
31
31
|
- - "~>"
|
|
32
32
|
- !ruby/object:Gem::Version
|
|
33
|
-
version: '
|
|
33
|
+
version: '12.0'
|
|
34
34
|
type: :development
|
|
35
35
|
prerelease: false
|
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
|
37
37
|
requirements:
|
|
38
38
|
- - "~>"
|
|
39
39
|
- !ruby/object:Gem::Version
|
|
40
|
-
version: '
|
|
40
|
+
version: '12.0'
|
|
41
41
|
- !ruby/object:Gem::Dependency
|
|
42
42
|
name: rspec
|
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -58,14 +58,56 @@ dependencies:
|
|
|
58
58
|
requirements:
|
|
59
59
|
- - "~>"
|
|
60
60
|
- !ruby/object:Gem::Version
|
|
61
|
-
version: 0
|
|
61
|
+
version: '1.0'
|
|
62
62
|
type: :development
|
|
63
63
|
prerelease: false
|
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
|
65
65
|
requirements:
|
|
66
66
|
- - "~>"
|
|
67
67
|
- !ruby/object:Gem::Version
|
|
68
|
-
version: 0
|
|
68
|
+
version: '1.0'
|
|
69
|
+
- !ruby/object:Gem::Dependency
|
|
70
|
+
name: rubocop-rake
|
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
|
72
|
+
requirements:
|
|
73
|
+
- - ">="
|
|
74
|
+
- !ruby/object:Gem::Version
|
|
75
|
+
version: '0'
|
|
76
|
+
type: :development
|
|
77
|
+
prerelease: false
|
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
79
|
+
requirements:
|
|
80
|
+
- - ">="
|
|
81
|
+
- !ruby/object:Gem::Version
|
|
82
|
+
version: '0'
|
|
83
|
+
- !ruby/object:Gem::Dependency
|
|
84
|
+
name: rubocop-rspec
|
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
|
86
|
+
requirements:
|
|
87
|
+
- - ">="
|
|
88
|
+
- !ruby/object:Gem::Version
|
|
89
|
+
version: '0'
|
|
90
|
+
type: :development
|
|
91
|
+
prerelease: false
|
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
93
|
+
requirements:
|
|
94
|
+
- - ">="
|
|
95
|
+
- !ruby/object:Gem::Version
|
|
96
|
+
version: '0'
|
|
97
|
+
- !ruby/object:Gem::Dependency
|
|
98
|
+
name: colorize
|
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
|
100
|
+
requirements:
|
|
101
|
+
- - ">="
|
|
102
|
+
- !ruby/object:Gem::Version
|
|
103
|
+
version: '0'
|
|
104
|
+
type: :runtime
|
|
105
|
+
prerelease: false
|
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
107
|
+
requirements:
|
|
108
|
+
- - ">="
|
|
109
|
+
- !ruby/object:Gem::Version
|
|
110
|
+
version: '0'
|
|
69
111
|
- !ruby/object:Gem::Dependency
|
|
70
112
|
name: curses
|
|
71
113
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -106,7 +148,7 @@ homepage: http://github.com/dabroz/multish
|
|
|
106
148
|
licenses:
|
|
107
149
|
- MIT
|
|
108
150
|
metadata: {}
|
|
109
|
-
post_install_message:
|
|
151
|
+
post_install_message:
|
|
110
152
|
rdoc_options: []
|
|
111
153
|
require_paths:
|
|
112
154
|
- lib
|
|
@@ -114,16 +156,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
114
156
|
requirements:
|
|
115
157
|
- - ">="
|
|
116
158
|
- !ruby/object:Gem::Version
|
|
117
|
-
version:
|
|
159
|
+
version: 2.4.0
|
|
118
160
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
119
161
|
requirements:
|
|
120
162
|
- - ">="
|
|
121
163
|
- !ruby/object:Gem::Version
|
|
122
164
|
version: '0'
|
|
123
165
|
requirements: []
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
signing_key:
|
|
166
|
+
rubygems_version: 3.1.4
|
|
167
|
+
signing_key:
|
|
127
168
|
specification_version: 4
|
|
128
169
|
summary: Run multiple commands in one terminal, side by side
|
|
129
170
|
test_files: []
|