From 2d5ac6de099d18efdfbfca83a0acf94e8a8acf6c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eloy=20Dur=C3=A1n?= Date: Fri, 17 Jan 2014 16:43:22 +0100 Subject: [PATCH] [command] Make the `ri` command work again. --- lib/motion/project/command/ri.rb | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/lib/motion/project/command/ri.rb b/lib/motion/project/command/ri.rb index 2bd14b6d..f6762f0e 100644 --- a/lib/motion/project/command/ri.rb +++ b/lib/motion/project/command/ri.rb @@ -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 " - 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