2986: Can now specify which fields you want to edit, because fields like 'uuid'
authorPeter Amstutz <peter.amstutz@curoverse.com>
Fri, 20 Jun 2014 15:16:54 +0000 (11:16 -0400)
committerPeter Amstutz <peter.amstutz@curoverse.com>
Fri, 20 Jun 2014 15:17:15 +0000 (11:17 -0400)
and 'modified_at' are not updatable.

sdk/cli/bin/arv

index 26fa154ca87009d6bb70f9479b0e376b27aa624c..4ce0940f6e06a58f36fd237423f247849f461aa0 100755 (executable)
@@ -139,11 +139,11 @@ def arv_edit client, arvados, global_opts, remaining_opts
   n = remaining_opts.shift
   if n.nil? or n == "-h" or n == "--help"
     puts head_banner
-    puts "Usage: arv edit [uuid]\n\n"
-    puts "Fetchs the specified Arvados object, opens an interactive text\n"
-    puts "editor on a text representation (json or yaml, use --format)\n"
-    puts "and then updates the object.  Will use 'nano' by default, customize\n"
-    puts "with the EDITOR or VISUAL environment variable."
+    puts "Usage: arv edit [uuid] [fields...]\n\n"
+    puts "Fetchs the specified Arvados object, select the specified fields, and\n"
+    puts "open an interactive text editor on a text representation (json or\n"
+    puts "yaml, use --format) and then updates the object.  Will use 'nano'\n"
+    puts "by default, customize with the EDITOR or VISUAL environment variable.\n"
     exit 255
   end
 
@@ -186,6 +186,10 @@ def arv_edit client, arvados, global_opts, remaining_opts
     abort "Failed to parse server response:\n" + e.to_s
   end
 
+  if remaining_opts.length > 0
+    results.select! { |k, v| remaining_opts.include? k }
+  end
+
   content = ""
 
   case global_opts[:format]