mothership 0.0.7 → 0.0.8
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/mothership.rb +6 -1
- data/lib/mothership/base.rb +4 -4
- data/lib/mothership/help.rb +9 -9
- data/lib/mothership/version.rb +1 -1
- metadata +3 -3
data/lib/mothership.rb
CHANGED
data/lib/mothership/base.rb
CHANGED
@@ -44,11 +44,11 @@ class Mothership
|
|
44
44
|
def execute(cmd, argv)
|
45
45
|
cmd.invoke(Parser.new(cmd).inputs(argv))
|
46
46
|
rescue Mothership::Error => e
|
47
|
-
puts e
|
48
|
-
puts ""
|
49
|
-
Mothership::Help.command_usage(cmd)
|
47
|
+
$stderr.puts e
|
48
|
+
$stderr.puts ""
|
49
|
+
Mothership::Help.command_usage(cmd, $stderr)
|
50
50
|
|
51
|
-
|
51
|
+
exit_status 1
|
52
52
|
end
|
53
53
|
|
54
54
|
# invoke a command with the given inputs
|
data/lib/mothership/help.rb
CHANGED
@@ -106,17 +106,17 @@ module Mothership::Help
|
|
106
106
|
command_usage(cmd)
|
107
107
|
end
|
108
108
|
|
109
|
-
def command_usage(cmd)
|
110
|
-
puts "Usage: #{cmd.usage}"
|
109
|
+
def command_usage(cmd, io = $stdout)
|
110
|
+
io.puts "Usage: #{cmd.usage}"
|
111
111
|
|
112
112
|
unless cmd.flags.empty?
|
113
|
-
puts ""
|
114
|
-
command_options(cmd)
|
113
|
+
io.puts ""
|
114
|
+
command_options(cmd, io)
|
115
115
|
end
|
116
116
|
end
|
117
117
|
|
118
|
-
def command_options(cmd)
|
119
|
-
puts "Options:"
|
118
|
+
def command_options(cmd, io = $stdout)
|
119
|
+
io.puts "Options:"
|
120
120
|
|
121
121
|
rev_flags = Hash.new { |h, k| h[k] = [] }
|
122
122
|
|
@@ -156,9 +156,9 @@ module Mothership::Help
|
|
156
156
|
|
157
157
|
usages.each do |u, d|
|
158
158
|
if d
|
159
|
-
puts " #{u.ljust(max_width)} #{d}"
|
159
|
+
io.puts " #{u.ljust(max_width)} #{d}"
|
160
160
|
else
|
161
|
-
puts " #{u}"
|
161
|
+
io.puts " #{u}"
|
162
162
|
end
|
163
163
|
end
|
164
164
|
end
|
@@ -207,7 +207,7 @@ class Mothership
|
|
207
207
|
end
|
208
208
|
|
209
209
|
def unknown_command(name)
|
210
|
-
puts "Unknown command '#{name}'. See 'help' for available commands."
|
210
|
+
$stderr.puts "Unknown command '#{name}'. See 'help' for available commands."
|
211
211
|
exit_status 1
|
212
212
|
end
|
213
213
|
|
data/lib/mothership/version.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mothership
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 15
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 8
|
10
|
+
version: 0.0.8
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Alex Suraci
|