[ARVADOS] updated: 9dd2519aa44d751e6f0144226058dc5a98e4bcb5

git at public.curoverse.com git at public.curoverse.com
Thu Oct 9 11:37:46 EDT 2014


Summary of changes:
 sdk/cli/bin/arv | 31 ++++++++++++++++++++++++++++---
 1 file changed, 28 insertions(+), 3 deletions(-)

       via  9dd2519aa44d751e6f0144226058dc5a98e4bcb5 (commit)
      from  3d0cb4307773c5cba2af35fe4eff49fde7f224cc (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.


commit 9dd2519aa44d751e6f0144226058dc5a98e4bcb5
Author: Peter Amstutz <peter.amstutz at curoverse.com>
Date:   Thu Oct 9 11:37:39 2014 -0400

    3656: Support additional create parameters on the command line, only open
    editor on the object itself, should be less confusing.

diff --git a/sdk/cli/bin/arv b/sdk/cli/bin/arv
index c6d355b..2acc626 100755
--- a/sdk/cli/bin/arv
+++ b/sdk/cli/bin/arv
@@ -357,9 +357,33 @@ def arv_create client, arvados, global_opts, remaining_opts
   end
   rsc = rsc.first
 
-  newobj = {object_type => {}}
+  discovered_params = arvados.discovery_document["resources"][rsc]["methods"]["create"]["parameters"]
+  method_opts = Trollop::options do
+    banner head_banner
+    banner "Usage: arv create [--project-uuid] #{object_type} [create parameters]"
+    banner ""
+    banner "This method supports the following parameters:"
+    banner ""
+    discovered_params.each do |k,v|
+      opts = Hash.new()
+      opts[:type] = v["type"].to_sym if v.include?("type")
+      if [:datetime, :text, :object, :array].index opts[:type]
+        opts[:type] = :string                       # else trollop bork
+      end
+      opts[:default] = v["default"] if v.include?("default")
+      opts[:default] = v["default"].to_i if opts[:type] == :integer
+      opts[:default] = to_boolean(v["default"]) if opts[:type] == :boolean
+      opts[:required] = true if v.include?("required") and v["required"]
+      description = ''
+      description = '  ' + v["description"] if v.include?("description")
+      opt k.to_sym, description, opts
+    end
+  end
+
+
+  newobj = {}
   if create_opts[:project_uuid]
-    newobj[object_type]["owner_uuid"] = create_opts[:project_uuid]
+    newobj["owner_uuid"] = create_opts[:project_uuid]
   end
 
   case global_opts[:format]
@@ -380,7 +404,8 @@ def arv_create client, arvados, global_opts, remaining_opts
     dumped = Oj.dump(newobj)
 
     result = client.execute(:api_method => eval(api_method),
-                            :body_object => newobj,
+                            :parameters => method_opts,
+                            :body_object => {object_type => newobj},
                             :authenticated => false,
                             :headers => {
                               authorization: 'OAuth2 '+ENV['ARVADOS_API_TOKEN']

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list