[command] Make the ri command work again.

This commit is contained in:
Eloy Durán
2014-01-17 16:43:22 +01:00
parent 3e935532d2
commit 2d5ac6de09

View File

@@ -24,17 +24,25 @@
module Motion; module Project
class RI < Command
self.summary = 'Display API reference.'
self.description = 'Display Cocoa(Touch) API reference documentation ' \
'using a command-line interface.'
def run(args)
if args.size <= 0
die "Usage: motion ri <API-name>"
end
self.arguments = 'API-NAME'
def initialize(argv)
@api_name = argv.shift_argument
super
end
def validate!
super
die "Specify a term to search the API reference for." unless @api_name
end
def run
line = "/Library/RubyMotion/lib/yard/bin/yri --db /Library/RubyMotion/doc/yardoc "
if pager = ENV['PAGER']
line << "-p #{pager} "
end
line << "#{args[0]}"
line << "-p #{pager} "
line << "#{@api_name}"
system(line)
end
end