lib/tw/app/main.rb in tw-0.2.4 vs lib/tw/app/main.rb in tw-0.2.5

- old
+ new

@@ -50,10 +50,11 @@ arg :dm, 'show direct messages' arg 'dm:to', 'create direct message' arg :search, 'search public timeline', :alias => :s arg :stream, 'show user stream', :alias => :st arg :pipe, 'pipe tweet' + arg :format, 'output format', :default => 'text' arg :version, 'show version', :alias => :v arg :help, 'show help', :alias => :h validate :user, 'invalid user name' do |v| v =~ /^[a-zA-Z0-9_]+$/ @@ -81,31 +82,33 @@ STDERR.puts " tw @username @user2 @user2/listname" STDERR.puts " tw --search=ruby" STDERR.puts " tw --stream" STDERR.puts " tw --stream:filter=ruby,java" STDERR.puts " tw --dm:to=username \"hello!\"" + STDERR.puts " tw --format=json" + STDERR.puts ' tw --format="@#{user} #{text} - http://twitter.com/#{user}/#{id}"' on_exit end regist_cmds cmds.each do |name, cmd| next unless @parser[name] - cmd.call @parser[name] + cmd.call @parser[name], @parser end auth if @parser.argv.size < 1 - Render.display client.mentions + Render.display client.mentions, @parser[:format] elsif all_requests?(@parser.argv) Render.display Parallel.map(@parser.argv, :in_threads => @parser.argv.size){|arg| if user = username?(arg) res = client.user_timeline user elsif (user, list =listname?(arg)) != false res = client.list_timeline(user, list) end res - } + }, @parser[:format] else message = @parser.argv.join(' ') if (len = message.split(//u).size) > 140 STDERR.puts "tweet too long (#{len} chars)" on_error