def run(options, arguments)
if arguments.size > 1
$stderr.puts "usage: #{usage}"
exit 1
end
if arguments.length == 0
text = ''
text << "nanoc, a static site compiler written in Ruby.\n"
text << "\n"
text << "Available commands:\n"
text << "\n"
@base.commands.sort.each do |command|
text << sprintf(" %-20s %s\n", command.name, command.short_desc)
end
text << "\n"
text << "Global options:\n"
text << "\n"
@base.global_option_definitions.sort { |x,y| x[:long] <=> y[:long] }.each do |opt_def|
text << sprintf(" -%1s --%-15s %s\n", opt_def[:short], opt_def[:long], opt_def[:desc])
end
puts text
elsif arguments.length == 1
command = @base.command_named(arguments[0])
puts command.help
end
end