You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@whimsical.apache.org by se...@apache.org on 2017/12/13 14:01:56 UTC

[whimsy] branch master updated: Call methods directly from command line

This is an automated email from the ASF dual-hosted git repository.

sebb pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/whimsy.git


The following commit(s) were added to refs/heads/master by this push:
     new 939e3d6  Call methods directly from command line
939e3d6 is described below

commit 939e3d6ef6e0dc08cf380db8bbfc839b86de8511
Author: Sebb <se...@apache.org>
AuthorDate: Wed Dec 13 14:01:50 2017 +0000

    Call methods directly from command line
---
 tools/ponyapi.rb | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/tools/ponyapi.rb b/tools/ponyapi.rb
index cb0710c..e97c200 100644
--- a/tools/ponyapi.rb
+++ b/tools/ponyapi.rb
@@ -147,6 +147,25 @@ module PonyAPI
 end
 
 if __FILE__ == $0
+  method = ARGV.shift
+  if method
+    meth = PonyAPI.method(method)
+    # process args to allow use of nil, true, false
+    args = ARGV.map do |arg|
+      case arg
+      when 'nil'
+        nil
+      when 'true'
+        true
+      when 'false'
+        false
+      else
+        arg
+      end
+    end
+    $stderr.puts "Calling #{method}() using #{args.inspect}"
+    puts meth.call(*args).inspect
+  end
 #  PonyAPI.get_pony_mbox('.', 'dev', 'whimsical', 2017, 01, nil)
 #  PonyAPI.get_pony_stats('.', 'dev', 'whimsical', 2017, 01, nil)
 #  puts PonyAPI.get_pony_prefs(nil, nil, true)['login'].inspect

-- 
To stop receiving notification emails like this one, please contact
['"commits@whimsical.apache.org" <co...@whimsical.apache.org>'].