Skip to content

Commit 41b9c50

Browse files
committed
Print to stderr. Prefix with [runx].
1 parent c48aea0 commit 41b9c50

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

runx.rb

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,11 @@ def load(file)
4949
end
5050

5151
def show_help
52-
puts 'Tasks:'
52+
$stderr.puts 'Tasks:'
5353
width = @tasks.map { |name, task| name.length }.max
5454
@tasks.each do |name, task|
5555
space = ' ' * (width - name.length + 6)
56-
puts " #{task.name}#{space}#{task.doc}"
56+
$stderr.puts " #{task.name}#{space}#{task.doc}"
5757
end
5858
end
5959

@@ -120,7 +120,7 @@ def find_runfile
120120

121121
runfile = find_runfile
122122
if runfile.nil?
123-
$stderr.puts "No Runfile found."
123+
$stderr.puts '[runx] No Runfile found.'
124124
exit 1
125125
end
126126

@@ -136,13 +136,16 @@ def find_runfile
136136
# http://ruby-doc.org/core-2.1.5/Kernel.html#method-i-gets
137137
args = ARGV[1...ARGV.length]
138138
ARGV.clear
139+
140+
dir = File.dirname(runfile)
141+
$stderr.puts "[runx] In #{dir}."
139142
manager.run_task(task_name, *args)
140143
end
141144
rescue TaskNotFoundError => e
142-
puts "Task '#{e.name}' not found."
145+
$stderr.puts "[runx] Task '#{e.name}' not found."
143146
exit 1
144147
rescue DuplicateTaskError => e
145-
puts "Task '#{e.name}' is already defined."
148+
$stderr.puts "[runx] Task '#{e.name}' is already defined."
146149
exit 1
147150
rescue Interrupt => e
148151
# Ignore interrupt and exit.

0 commit comments

Comments
 (0)